diff --git a/custom_components/blueprint/__init__.py b/custom_components/blueprint/__init__.py index 3c3b94e..ae22b7f 100644 --- a/custom_components/blueprint/__init__.py +++ b/custom_components/blueprint/__init__.py @@ -5,8 +5,8 @@ For more details about this integration, please refer to https://github.com/custom-components/blueprint """ import asyncio -import logging from datetime import timedelta +import logging from homeassistant.config_entries import ConfigEntry from homeassistant.core import Config, HomeAssistant @@ -14,7 +14,7 @@ from homeassistant.exceptions import ConfigEntryNotReady from homeassistant.helpers.update_coordinator import DataUpdateCoordinator, UpdateFailed from sampleclient.client import Client -from .const import ( +from custom_components.blueprint.const import ( CONF_PASSWORD, CONF_USERNAME, DOMAIN, @@ -70,9 +70,7 @@ class BlueprintDataUpdateCoordinator(DataUpdateCoordinator): self.api = Client(username, password) self.platforms = [] - super().__init__( - hass, _LOGGER, name=DOMAIN, update_interval=SCAN_INTERVAL, - ) + super().__init__(hass, _LOGGER, name=DOMAIN, update_interval=SCAN_INTERVAL) async def _async_update_data(self): """Update data via library.""" diff --git a/custom_components/blueprint/config_flow.py b/custom_components/blueprint/config_flow.py index b030ed6..731d17c 100644 --- a/custom_components/blueprint/config_flow.py +++ b/custom_components/blueprint/config_flow.py @@ -1,9 +1,8 @@ """Adds config flow for Blueprint.""" -import voluptuous as vol from homeassistant import config_entries from homeassistant.core import callback - from sampleclient.client import Client +import voluptuous as vol from custom_components.blueprint.const import ( # pylint: disable=unused-import CONF_PASSWORD, @@ -58,7 +57,7 @@ class BlueprintFlowHandler(config_entries.ConfigFlow, domain=DOMAIN): return self.async_show_form( step_id="user", data_schema=vol.Schema( - {vol.Required(CONF_USERNAME): str, vol.Required(CONF_PASSWORD): str,} + {vol.Required(CONF_USERNAME): str, vol.Required(CONF_PASSWORD): str} ), errors=self._errors, ) diff --git a/custom_components/blueprint/entity.py b/custom_components/blueprint/entity.py index 1a64128..7972e37 100644 --- a/custom_components/blueprint/entity.py +++ b/custom_components/blueprint/entity.py @@ -1,7 +1,7 @@ """BlueprintEntity class""" from homeassistant.helpers import entity -from custom_components.blueprint.const import DOMAIN, VERSION, NAME +from custom_components.blueprint.const import DOMAIN, NAME, VERSION class BlueprintEntity(entity.Entity): diff --git a/custom_components/blueprint/manifest.json b/custom_components/blueprint/manifest.json index 5456514..5f5af27 100644 --- a/custom_components/blueprint/manifest.json +++ b/custom_components/blueprint/manifest.json @@ -10,4 +10,4 @@ "requirements": [ "sampleclient" ] -} \ No newline at end of file +} diff --git a/custom_components/blueprint/switch.py b/custom_components/blueprint/switch.py index 9ff0543..8cd1bcc 100644 --- a/custom_components/blueprint/switch.py +++ b/custom_components/blueprint/switch.py @@ -2,7 +2,6 @@ from homeassistant.components.switch import SwitchDevice from custom_components.blueprint.const import DEFAULT_NAME, DOMAIN, ICON, SWITCH - from custom_components.blueprint.entity import BlueprintEntity diff --git a/setup.cfg b/setup.cfg new file mode 100644 index 0000000..4b57c35 --- /dev/null +++ b/setup.cfg @@ -0,0 +1,35 @@ +[flake8] +exclude = .venv,.git,.tox,docs,venv,bin,lib,deps,build +doctests = True +# To work with Black +max-line-length = 88 +# E501: line too long +# W503: Line break occurred before a binary operator +# E203: Whitespace before ':' +# D202 No blank lines allowed after function docstring +# W504 line break after binary operator +ignore = + E501, + W503, + E203, + D202, + W504 + +[isort] +# https://github.com/timothycrosley/isort +# https://github.com/timothycrosley/isort/wiki/isort-Settings +# splits long import on multiple lines indented by 4 spaces +multi_line_output = 3 +include_trailing_comma=True +force_grid_wrap=0 +use_parentheses=True +line_length=88 +indent = " " +# by default isort don't check module indexes +not_skip = __init__.py +# will group `import x` and `from x import` of the same module. +force_sort_within_sections = true +sections = FUTURE,STDLIB,INBETWEENS,THIRDPARTY,FIRSTPARTY,LOCALFOLDER +default_section = THIRDPARTY +known_first_party = custom_components.blueprint +combine_as_imports = true