From 8a1738281aff91aa4f10871f858c27a82b44da7c Mon Sep 17 00:00:00 2001 From: bouni Date: Sat, 12 Oct 2019 22:02:12 +0200 Subject: [PATCH] moved imports to top level (#27454) --- homeassistant/components/abode/__init__.py | 9 ++++----- homeassistant/components/abode/binary_sensor.py | 5 +++-- homeassistant/components/abode/camera.py | 4 ++-- homeassistant/components/abode/cover.py | 3 ++- homeassistant/components/abode/light.py | 3 ++- homeassistant/components/abode/lock.py | 3 ++- homeassistant/components/abode/sensor.py | 3 ++- homeassistant/components/abode/switch.py | 5 +++-- 8 files changed, 20 insertions(+), 15 deletions(-) diff --git a/homeassistant/components/abode/__init__.py b/homeassistant/components/abode/__init__.py index f43cbc50f98..b7f13d49b69 100644 --- a/homeassistant/components/abode/__init__.py +++ b/homeassistant/components/abode/__init__.py @@ -2,6 +2,10 @@ import logging from functools import partial from requests.exceptions import HTTPError, ConnectTimeout +import abodepy +import abodepy.helpers.constants as CONST +from abodepy.exceptions import AbodeException +import abodepy.helpers.timeline as TIMELINE import voluptuous as vol @@ -98,7 +102,6 @@ class AbodeSystem: def __init__(self, username, password, cache, name, polling, exclude, lights): """Initialize the system.""" - import abodepy self.abode = abodepy.Abode( username, @@ -124,7 +127,6 @@ class AbodeSystem: def is_light(self, device): """Check if a switch device is configured as a light.""" - import abodepy.helpers.constants as CONST return device.generic_type == CONST.TYPE_LIGHT or ( device.generic_type == CONST.TYPE_SWITCH and device.device_id in self.lights @@ -133,7 +135,6 @@ class AbodeSystem: def setup(hass, config): """Set up Abode component.""" - from abodepy.exceptions import AbodeException conf = config[DOMAIN] username = conf.get(CONF_USERNAME) @@ -172,7 +173,6 @@ def setup(hass, config): def setup_hass_services(hass): """Home assistant services.""" - from abodepy.exceptions import AbodeException def change_setting(call): """Change an Abode system setting.""" @@ -246,7 +246,6 @@ def setup_hass_events(hass): def setup_abode_events(hass): """Event callbacks.""" - import abodepy.helpers.timeline as TIMELINE def event_callback(event, event_json): """Handle an event callback from Abode.""" diff --git a/homeassistant/components/abode/binary_sensor.py b/homeassistant/components/abode/binary_sensor.py index e37f6a465a4..3ae7f41d84e 100644 --- a/homeassistant/components/abode/binary_sensor.py +++ b/homeassistant/components/abode/binary_sensor.py @@ -1,6 +1,9 @@ """Support for Abode Security System binary sensors.""" import logging +import abodepy.helpers.constants as CONST +import abodepy.helpers.timeline as TIMELINE + from homeassistant.components.binary_sensor import BinarySensorDevice from . import DOMAIN as ABODE_DOMAIN, AbodeAutomation, AbodeDevice @@ -10,8 +13,6 @@ _LOGGER = logging.getLogger(__name__) def setup_platform(hass, config, add_entities, discovery_info=None): """Set up a sensor for an Abode device.""" - import abodepy.helpers.constants as CONST - import abodepy.helpers.timeline as TIMELINE data = hass.data[ABODE_DOMAIN] diff --git a/homeassistant/components/abode/camera.py b/homeassistant/components/abode/camera.py index 95755a644e2..f52bbe17475 100644 --- a/homeassistant/components/abode/camera.py +++ b/homeassistant/components/abode/camera.py @@ -3,6 +3,8 @@ from datetime import timedelta import logging import requests +import abodepy.helpers.constants as CONST +import abodepy.helpers.timeline as TIMELINE from homeassistant.components.camera import Camera from homeassistant.util import Throttle @@ -16,8 +18,6 @@ _LOGGER = logging.getLogger(__name__) def setup_platform(hass, config, add_entities, discovery_info=None): """Set up Abode camera devices.""" - import abodepy.helpers.constants as CONST - import abodepy.helpers.timeline as TIMELINE data = hass.data[ABODE_DOMAIN] diff --git a/homeassistant/components/abode/cover.py b/homeassistant/components/abode/cover.py index 4c868daf4ba..13d46c53f73 100644 --- a/homeassistant/components/abode/cover.py +++ b/homeassistant/components/abode/cover.py @@ -1,6 +1,8 @@ """Support for Abode Security System covers.""" import logging +import abodepy.helpers.constants as CONST + from homeassistant.components.cover import CoverDevice from . import DOMAIN as ABODE_DOMAIN, AbodeDevice @@ -10,7 +12,6 @@ _LOGGER = logging.getLogger(__name__) def setup_platform(hass, config, add_entities, discovery_info=None): """Set up Abode cover devices.""" - import abodepy.helpers.constants as CONST data = hass.data[ABODE_DOMAIN] diff --git a/homeassistant/components/abode/light.py b/homeassistant/components/abode/light.py index 8e6691560e5..6551cba2ef1 100644 --- a/homeassistant/components/abode/light.py +++ b/homeassistant/components/abode/light.py @@ -2,6 +2,8 @@ import logging from math import ceil +import abodepy.helpers.constants as CONST + from homeassistant.components.light import ( ATTR_BRIGHTNESS, ATTR_COLOR_TEMP, @@ -23,7 +25,6 @@ _LOGGER = logging.getLogger(__name__) def setup_platform(hass, config, add_entities, discovery_info=None): """Set up Abode light devices.""" - import abodepy.helpers.constants as CONST data = hass.data[ABODE_DOMAIN] diff --git a/homeassistant/components/abode/lock.py b/homeassistant/components/abode/lock.py index c1272a3de5f..ff069751605 100644 --- a/homeassistant/components/abode/lock.py +++ b/homeassistant/components/abode/lock.py @@ -1,6 +1,8 @@ """Support for Abode Security System locks.""" import logging +import abodepy.helpers.constants as CONST + from homeassistant.components.lock import LockDevice from . import DOMAIN as ABODE_DOMAIN, AbodeDevice @@ -10,7 +12,6 @@ _LOGGER = logging.getLogger(__name__) def setup_platform(hass, config, add_entities, discovery_info=None): """Set up Abode lock devices.""" - import abodepy.helpers.constants as CONST data = hass.data[ABODE_DOMAIN] diff --git a/homeassistant/components/abode/sensor.py b/homeassistant/components/abode/sensor.py index ba28eab79c7..fca32b8dc43 100644 --- a/homeassistant/components/abode/sensor.py +++ b/homeassistant/components/abode/sensor.py @@ -1,6 +1,8 @@ """Support for Abode Security System sensors.""" import logging +import abodepy.helpers.constants as CONST + from homeassistant.const import ( DEVICE_CLASS_HUMIDITY, DEVICE_CLASS_ILLUMINANCE, @@ -21,7 +23,6 @@ SENSOR_TYPES = { def setup_platform(hass, config, add_entities, discovery_info=None): """Set up a sensor for an Abode device.""" - import abodepy.helpers.constants as CONST data = hass.data[ABODE_DOMAIN] diff --git a/homeassistant/components/abode/switch.py b/homeassistant/components/abode/switch.py index 82a550df1a5..4192ebb4485 100644 --- a/homeassistant/components/abode/switch.py +++ b/homeassistant/components/abode/switch.py @@ -1,6 +1,9 @@ """Support for Abode Security System switches.""" import logging +import abodepy.helpers.constants as CONST +import abodepy.helpers.timeline as TIMELINE + from homeassistant.components.switch import SwitchDevice from . import DOMAIN as ABODE_DOMAIN, AbodeAutomation, AbodeDevice @@ -10,8 +13,6 @@ _LOGGER = logging.getLogger(__name__) def setup_platform(hass, config, add_entities, discovery_info=None): """Set up Abode switch devices.""" - import abodepy.helpers.constants as CONST - import abodepy.helpers.timeline as TIMELINE data = hass.data[ABODE_DOMAIN]