Skip to content

Commit

Permalink
Feature/setup cfg (#28)
Browse files Browse the repository at this point in the history
* Add setup.cfg

* Run black and isort.

* Add blueprint to first party.

* Make const import consistent.
  • Loading branch information
eseglem authored May 14, 2020
1 parent b22ae59 commit 99b07e5
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 11 deletions.
8 changes: 3 additions & 5 deletions custom_components/blueprint/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@
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
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,
Expand Down Expand Up @@ -70,9 +70,7 @@ def __init__(self, hass, username, password):
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."""
Expand Down
5 changes: 2 additions & 3 deletions custom_components/blueprint/config_flow.py
Original file line number Diff line number Diff line change
@@ -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,
Expand Down Expand Up @@ -58,7 +57,7 @@ async def _show_config_form(self, user_input): # pylint: disable=unused-argumen
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,
)
Expand Down
2 changes: 1 addition & 1 deletion custom_components/blueprint/entity.py
Original file line number Diff line number Diff line change
@@ -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):
Expand Down
2 changes: 1 addition & 1 deletion custom_components/blueprint/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@
"requirements": [
"sampleclient"
]
}
}
1 change: 0 additions & 1 deletion custom_components/blueprint/switch.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down
35 changes: 35 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 99b07e5

Please sign in to comment.