diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 8595be1..45180dc 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -36,6 +36,10 @@ repos: hooks: - id: black language_version: python3 +- repo: https://github.com/PyCQA/flake8 + rev: 6.0.0 + hooks: + - id: flake8 - repo: https://github.com/pre-commit/pygrep-hooks rev: v1.10.0 hooks: diff --git a/custom_components/cover_time_based/__init__.py b/custom_components/cover_time_based/__init__.py index a7d8761..8a5c994 100644 --- a/custom_components/cover_time_based/__init__.py +++ b/custom_components/cover_time_based/__init__.py @@ -17,8 +17,6 @@ from .const import CONF_ENTITY_DOWN from .const import CONF_ENTITY_UP -from .const import CONF_INVERT -from .const import CONF_TARGET_DEVICE_CLASS _LOGGER = logging.getLogger(__name__) diff --git a/custom_components/cover_time_based/config_flow.py b/custom_components/cover_time_based/config_flow.py index cfd2a69..b5f52e0 100644 --- a/custom_components/cover_time_based/config_flow.py +++ b/custom_components/cover_time_based/config_flow.py @@ -5,22 +5,15 @@ from typing import Any import voluptuous as vol -from homeassistant.components.cover import CoverDeviceClass -from homeassistant.const import CONF_ENTITY_ID from homeassistant.const import CONF_NAME from homeassistant.const import Platform from homeassistant.helpers import entity_registry as er from homeassistant.helpers import selector from homeassistant.helpers.schema_config_entry_flow import SchemaConfigFlowHandler from homeassistant.helpers.schema_config_entry_flow import SchemaFlowFormStep -from homeassistant.helpers.schema_config_entry_flow import ( - wrapped_entity_config_entry_title, -) from .const import CONF_ENTITY_DOWN from .const import CONF_ENTITY_UP -from .const import CONF_INVERT -from .const import CONF_TARGET_DEVICE_CLASS from .const import CONF_TIME_CLOSE from .const import CONF_TIME_OPEN from .const import DOMAIN diff --git a/custom_components/cover_time_based/const.py b/custom_components/cover_time_based/const.py index 9f992a6..fef5461 100644 --- a/custom_components/cover_time_based/const.py +++ b/custom_components/cover_time_based/const.py @@ -3,8 +3,6 @@ DOMAIN: Final = "cover_time_based" -CONF_INVERT: Final = "invert" -CONF_TARGET_DEVICE_CLASS: Final = "target_device" CONF_ENTITY_UP: Final = "up" CONF_ENTITY_DOWN: Final = "down" CONF_TIME_OPEN: Final = "time_open" diff --git a/custom_components/cover_time_based/cover.py b/custom_components/cover_time_based/cover.py index 6e3ba04..7dce2de 100644 --- a/custom_components/cover_time_based/cover.py +++ b/custom_components/cover_time_based/cover.py @@ -3,35 +3,22 @@ import logging from datetime import timedelta -from typing import Any from homeassistant.components.cover import ATTR_CURRENT_POSITION from homeassistant.components.cover import ATTR_POSITION from homeassistant.components.cover import CoverEntity -from homeassistant.components.cover import CoverEntityFeature from homeassistant.components.cover import DOMAIN as COVER_DOMAIN -from homeassistant.components.cover import PLATFORM_SCHEMA -from homeassistant.components.switch import DOMAIN as SWITCH_DOMAIN from homeassistant.config_entries import ConfigEntry -from homeassistant.const import ATTR_ENTITY_ID -from homeassistant.const import CONF_ENTITY_ID -from homeassistant.const import CONF_NAME from homeassistant.const import SERVICE_CLOSE_COVER from homeassistant.const import SERVICE_OPEN_COVER from homeassistant.const import SERVICE_STOP_COVER -from homeassistant.const import SERVICE_TURN_OFF -from homeassistant.const import SERVICE_TURN_ON -from homeassistant.const import STATE_ON from homeassistant.core import callback -from homeassistant.core import Event -from homeassistant.core import EventStateChangedData from homeassistant.core import HomeAssistant from homeassistant.helpers import device_registry as dr from homeassistant.helpers import entity_registry as er from homeassistant.helpers.device_registry import DeviceEntry from homeassistant.helpers.entity_platform import AddEntitiesCallback from homeassistant.helpers.event import async_track_time_interval -from homeassistant.helpers.event import async_track_utc_time_change from homeassistant.helpers.restore_state import RestoreEntity from homeassistant.util import slugify diff --git a/setup.cfg b/setup.cfg new file mode 100644 index 0000000..17c4f7a --- /dev/null +++ b/setup.cfg @@ -0,0 +1,6 @@ +[flake8] +max-line-length = 100 +select = W,B,F,E711,E712,E901 +extend-ignore = E203,B005,F811,F821,F403,F405,W503 +exclude = .git,.eggs,__pycache__,build,dist,venv +max-complexity = 11