Skip to content

Commit d7d71b8

Browse files
authored
Format with black (pnbruckner#25)
1 parent 0105755 commit d7d71b8

File tree

3 files changed

+163
-111
lines changed

3 files changed

+163
-111
lines changed

custom_components/composite/__init__.py

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -4,45 +4,49 @@
44

55
import voluptuous as vol
66

7-
from homeassistant.requirements import (
8-
async_process_requirements, RequirementsNotFound)
7+
from homeassistant.requirements import async_process_requirements, RequirementsNotFound
98
from homeassistant.components.device_tracker import DOMAIN as DT_DOMAIN
109
from homeassistant.const import CONF_PLATFORM
1110
import homeassistant.helpers.config_validation as cv
1211

1312
from .const import CONF_TIME_AS, DOMAIN, TZ_DEVICE_LOCAL, TZ_DEVICE_UTC
1413

15-
CONF_TZ_FINDER = 'tz_finder'
16-
DEFAULT_TZ_FINDER = 'timezonefinderL==4.0.2'
14+
CONF_TZ_FINDER = "tz_finder"
15+
DEFAULT_TZ_FINDER = "timezonefinderL==4.0.2"
1716

18-
CONFIG_SCHEMA = vol.Schema({
19-
vol.Optional(DOMAIN, default=dict): vol.Schema({
20-
vol.Optional(CONF_TZ_FINDER, default=DEFAULT_TZ_FINDER):
21-
cv.string,
22-
}),
23-
}, extra=vol.ALLOW_EXTRA)
17+
CONFIG_SCHEMA = vol.Schema(
18+
{
19+
vol.Optional(DOMAIN, default=dict): vol.Schema(
20+
{vol.Optional(CONF_TZ_FINDER, default=DEFAULT_TZ_FINDER): cv.string}
21+
),
22+
},
23+
extra=vol.ALLOW_EXTRA,
24+
)
2425

2526
_LOGGER = logging.getLogger(__name__)
2627

2728

2829
def setup(hass, config):
29-
if (any(conf[CONF_TIME_AS] in (TZ_DEVICE_UTC, TZ_DEVICE_LOCAL)
30-
for conf in (config.get(DT_DOMAIN) or [])
31-
if conf[CONF_PLATFORM] == DOMAIN)):
30+
if any(
31+
conf[CONF_TIME_AS] in (TZ_DEVICE_UTC, TZ_DEVICE_LOCAL)
32+
for conf in (config.get(DT_DOMAIN) or [])
33+
if conf[CONF_PLATFORM] == DOMAIN
34+
):
3235
pkg = config[DOMAIN][CONF_TZ_FINDER]
3336
try:
3437
asyncio.run_coroutine_threadsafe(
3538
async_process_requirements(
36-
hass, '{}.{}'.format(DOMAIN, DT_DOMAIN), [pkg]),
37-
hass.loop
39+
hass, "{}.{}".format(DOMAIN, DT_DOMAIN), [pkg]
40+
),
41+
hass.loop,
3842
).result()
3943
except RequirementsNotFound:
40-
_LOGGER.debug('Process requirements failed: %s', pkg)
44+
_LOGGER.debug("Process requirements failed: %s", pkg)
4145
return False
4246
else:
43-
_LOGGER.debug('Process requirements suceeded: %s', pkg)
47+
_LOGGER.debug("Process requirements suceeded: %s", pkg)
4448

45-
if pkg.split('==')[0].strip().endswith('L'):
49+
if pkg.split("==")[0].strip().endswith("L"):
4650
from timezonefinderL import TimezoneFinder
4751
else:
4852
from timezonefinder import TimezoneFinder
Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
"""Constants for Composite Integration."""
2-
DOMAIN = 'composite'
2+
DOMAIN = "composite"
33

4-
CONF_REQ_MOVEMENT = 'require_movement'
5-
CONF_TIME_AS = 'time_as'
4+
CONF_REQ_MOVEMENT = "require_movement"
5+
CONF_TIME_AS = "time_as"
66

7-
TZ_UTC = 'utc'
8-
TZ_LOCAL = 'local'
9-
TZ_DEVICE_UTC = 'device_or_utc'
10-
TZ_DEVICE_LOCAL = 'device_or_local'
7+
TZ_UTC = "utc"
8+
TZ_LOCAL = "local"
9+
TZ_DEVICE_UTC = "device_or_utc"
10+
TZ_DEVICE_LOCAL = "device_or_local"
1111
# First item in list is default.
1212
TIME_AS_OPTS = [TZ_UTC, TZ_LOCAL, TZ_DEVICE_UTC, TZ_DEVICE_LOCAL]

0 commit comments

Comments
 (0)