Feature/setup cfg (#28)
* Add setup.cfg * Run black and isort. * Add blueprint to first party. * Make const import consistent.
This commit is contained in:
parent
b22ae5949b
commit
99b07e5a7a
@ -5,8 +5,8 @@ For more details about this integration, please refer to
|
|||||||
https://github.com/custom-components/blueprint
|
https://github.com/custom-components/blueprint
|
||||||
"""
|
"""
|
||||||
import asyncio
|
import asyncio
|
||||||
import logging
|
|
||||||
from datetime import timedelta
|
from datetime import timedelta
|
||||||
|
import logging
|
||||||
|
|
||||||
from homeassistant.config_entries import ConfigEntry
|
from homeassistant.config_entries import ConfigEntry
|
||||||
from homeassistant.core import Config, HomeAssistant
|
from homeassistant.core import Config, HomeAssistant
|
||||||
@ -14,7 +14,7 @@ from homeassistant.exceptions import ConfigEntryNotReady
|
|||||||
from homeassistant.helpers.update_coordinator import DataUpdateCoordinator, UpdateFailed
|
from homeassistant.helpers.update_coordinator import DataUpdateCoordinator, UpdateFailed
|
||||||
from sampleclient.client import Client
|
from sampleclient.client import Client
|
||||||
|
|
||||||
from .const import (
|
from custom_components.blueprint.const import (
|
||||||
CONF_PASSWORD,
|
CONF_PASSWORD,
|
||||||
CONF_USERNAME,
|
CONF_USERNAME,
|
||||||
DOMAIN,
|
DOMAIN,
|
||||||
@ -70,9 +70,7 @@ class BlueprintDataUpdateCoordinator(DataUpdateCoordinator):
|
|||||||
self.api = Client(username, password)
|
self.api = Client(username, password)
|
||||||
self.platforms = []
|
self.platforms = []
|
||||||
|
|
||||||
super().__init__(
|
super().__init__(hass, _LOGGER, name=DOMAIN, update_interval=SCAN_INTERVAL)
|
||||||
hass, _LOGGER, name=DOMAIN, update_interval=SCAN_INTERVAL,
|
|
||||||
)
|
|
||||||
|
|
||||||
async def _async_update_data(self):
|
async def _async_update_data(self):
|
||||||
"""Update data via library."""
|
"""Update data via library."""
|
||||||
|
@ -1,9 +1,8 @@
|
|||||||
"""Adds config flow for Blueprint."""
|
"""Adds config flow for Blueprint."""
|
||||||
import voluptuous as vol
|
|
||||||
from homeassistant import config_entries
|
from homeassistant import config_entries
|
||||||
from homeassistant.core import callback
|
from homeassistant.core import callback
|
||||||
|
|
||||||
from sampleclient.client import Client
|
from sampleclient.client import Client
|
||||||
|
import voluptuous as vol
|
||||||
|
|
||||||
from custom_components.blueprint.const import ( # pylint: disable=unused-import
|
from custom_components.blueprint.const import ( # pylint: disable=unused-import
|
||||||
CONF_PASSWORD,
|
CONF_PASSWORD,
|
||||||
@ -58,7 +57,7 @@ class BlueprintFlowHandler(config_entries.ConfigFlow, domain=DOMAIN):
|
|||||||
return self.async_show_form(
|
return self.async_show_form(
|
||||||
step_id="user",
|
step_id="user",
|
||||||
data_schema=vol.Schema(
|
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,
|
errors=self._errors,
|
||||||
)
|
)
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
"""BlueprintEntity class"""
|
"""BlueprintEntity class"""
|
||||||
from homeassistant.helpers import entity
|
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):
|
class BlueprintEntity(entity.Entity):
|
||||||
|
@ -10,4 +10,4 @@
|
|||||||
"requirements": [
|
"requirements": [
|
||||||
"sampleclient"
|
"sampleclient"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
from homeassistant.components.switch import SwitchDevice
|
from homeassistant.components.switch import SwitchDevice
|
||||||
|
|
||||||
from custom_components.blueprint.const import DEFAULT_NAME, DOMAIN, ICON, SWITCH
|
from custom_components.blueprint.const import DEFAULT_NAME, DOMAIN, ICON, SWITCH
|
||||||
|
|
||||||
from custom_components.blueprint.entity import BlueprintEntity
|
from custom_components.blueprint.entity import BlueprintEntity
|
||||||
|
|
||||||
|
|
||||||
|
35
setup.cfg
Normal file
35
setup.cfg
Normal file
@ -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
|
Loading…
x
Reference in New Issue
Block a user