From 1dea0c9e340a4f03b4ec71f8112e99e63221ab50 Mon Sep 17 00:00:00 2001 From: Bas Nijholt Date: Mon, 9 Dec 2019 14:22:30 +0100 Subject: [PATCH] Sort imports according to PEP8 for components starting with "L" (#29771) --- homeassistant/components/lannouncer/notify.py | 5 +-- homeassistant/components/lcn/__init__.py | 2 +- homeassistant/components/lcn/services.py | 2 +- homeassistant/components/lifx_cloud/scene.py | 2 +- .../linksys_smart/device_tracker.py | 2 +- .../components/liveboxplaytv/media_player.py | 2 +- .../components/llamalab_automate/notify.py | 3 +- homeassistant/components/local_file/camera.py | 4 +- homeassistant/components/lockitron/lock.py | 4 +- .../components/logentries/__init__.py | 4 +- homeassistant/components/logger/__init__.py | 2 +- tests/components/litejet/test_init.py | 1 + tests/components/logbook/test_init.py | 42 +++++++++---------- tests/components/logentries/test_init.py | 4 +- tests/components/logger/test_init.py | 2 +- .../logi_circle/test_config_flow.py | 2 +- tests/components/london_air/test_sensor.py | 4 +- tests/components/lovelace/test_init.py | 4 +- 18 files changed, 45 insertions(+), 46 deletions(-) diff --git a/homeassistant/components/lannouncer/notify.py b/homeassistant/components/lannouncer/notify.py index 9512a75047bd..9421eb16f51e 100644 --- a/homeassistant/components/lannouncer/notify.py +++ b/homeassistant/components/lannouncer/notify.py @@ -5,14 +5,13 @@ from urllib.parse import urlencode import voluptuous as vol -from homeassistant.const import CONF_HOST, CONF_PORT -import homeassistant.helpers.config_validation as cv - from homeassistant.components.notify import ( ATTR_DATA, PLATFORM_SCHEMA, BaseNotificationService, ) +from homeassistant.const import CONF_HOST, CONF_PORT +import homeassistant.helpers.config_validation as cv ATTR_METHOD = "method" ATTR_METHOD_DEFAULT = "speak" diff --git a/homeassistant/components/lcn/__init__.py b/homeassistant/components/lcn/__init__.py index f7170340f1b3..14f25be70b0d 100644 --- a/homeassistant/components/lcn/__init__.py +++ b/homeassistant/components/lcn/__init__.py @@ -4,7 +4,6 @@ import logging import pypck import voluptuous as vol -import homeassistant.helpers.config_validation as cv from homeassistant.components.climate import DEFAULT_MAX_TEMP, DEFAULT_MIN_TEMP from homeassistant.const import ( CONF_ADDRESS, @@ -22,6 +21,7 @@ from homeassistant.const import ( TEMP_CELSIUS, TEMP_FAHRENHEIT, ) +import homeassistant.helpers.config_validation as cv from homeassistant.helpers.discovery import async_load_platform from homeassistant.helpers.entity import Entity diff --git a/homeassistant/components/lcn/services.py b/homeassistant/components/lcn/services.py index aba29e55176e..3c775224623c 100644 --- a/homeassistant/components/lcn/services.py +++ b/homeassistant/components/lcn/services.py @@ -2,13 +2,13 @@ import pypck import voluptuous as vol -import homeassistant.helpers.config_validation as cv from homeassistant.const import ( CONF_ADDRESS, CONF_BRIGHTNESS, CONF_STATE, CONF_UNIT_OF_MEASUREMENT, ) +import homeassistant.helpers.config_validation as cv from .const import ( CONF_CONNECTIONS, diff --git a/homeassistant/components/lifx_cloud/scene.py b/homeassistant/components/lifx_cloud/scene.py index ac4e0201fb87..4068ff20fe29 100644 --- a/homeassistant/components/lifx_cloud/scene.py +++ b/homeassistant/components/lifx_cloud/scene.py @@ -8,7 +8,7 @@ import async_timeout import voluptuous as vol from homeassistant.components.scene import Scene -from homeassistant.const import CONF_TOKEN, CONF_TIMEOUT, CONF_PLATFORM +from homeassistant.const import CONF_PLATFORM, CONF_TIMEOUT, CONF_TOKEN from homeassistant.helpers.aiohttp_client import async_get_clientsession import homeassistant.helpers.config_validation as cv diff --git a/homeassistant/components/linksys_smart/device_tracker.py b/homeassistant/components/linksys_smart/device_tracker.py index 1af84a4c4ab2..a2a8e317133d 100644 --- a/homeassistant/components/linksys_smart/device_tracker.py +++ b/homeassistant/components/linksys_smart/device_tracker.py @@ -4,13 +4,13 @@ import logging import requests import voluptuous as vol -import homeassistant.helpers.config_validation as cv from homeassistant.components.device_tracker import ( DOMAIN, PLATFORM_SCHEMA, DeviceScanner, ) from homeassistant.const import CONF_HOST +import homeassistant.helpers.config_validation as cv DEFAULT_TIMEOUT = 10 diff --git a/homeassistant/components/liveboxplaytv/media_player.py b/homeassistant/components/liveboxplaytv/media_player.py index 996b4f33b509..66fb383d677b 100644 --- a/homeassistant/components/liveboxplaytv/media_player.py +++ b/homeassistant/components/liveboxplaytv/media_player.py @@ -7,7 +7,7 @@ import pyteleloisirs import requests import voluptuous as vol -from homeassistant.components.media_player import MediaPlayerDevice, PLATFORM_SCHEMA +from homeassistant.components.media_player import PLATFORM_SCHEMA, MediaPlayerDevice from homeassistant.components.media_player.const import ( MEDIA_TYPE_CHANNEL, SUPPORT_NEXT_TRACK, diff --git a/homeassistant/components/llamalab_automate/notify.py b/homeassistant/components/llamalab_automate/notify.py index ab6a7032208d..5a3d4e0df38b 100644 --- a/homeassistant/components/llamalab_automate/notify.py +++ b/homeassistant/components/llamalab_automate/notify.py @@ -4,11 +4,10 @@ import logging import requests import voluptuous as vol +from homeassistant.components.notify import PLATFORM_SCHEMA, BaseNotificationService from homeassistant.const import CONF_API_KEY, CONF_DEVICE from homeassistant.helpers import config_validation as cv -from homeassistant.components.notify import PLATFORM_SCHEMA, BaseNotificationService - _LOGGER = logging.getLogger(__name__) _RESOURCE = "https://llamalab.com/automate/cloud/message" diff --git a/homeassistant/components/local_file/camera.py b/homeassistant/components/local_file/camera.py index 9bd476cfb275..1d06efeb7085 100644 --- a/homeassistant/components/local_file/camera.py +++ b/homeassistant/components/local_file/camera.py @@ -5,12 +5,12 @@ import os import voluptuous as vol -from homeassistant.const import CONF_NAME, ATTR_ENTITY_ID from homeassistant.components.camera import ( - Camera, CAMERA_SERVICE_SCHEMA, PLATFORM_SCHEMA, + Camera, ) +from homeassistant.const import ATTR_ENTITY_ID, CONF_NAME from homeassistant.helpers import config_validation as cv from .const import ( diff --git a/homeassistant/components/lockitron/lock.py b/homeassistant/components/lockitron/lock.py index b993f644ecd5..5840c7f55375 100644 --- a/homeassistant/components/lockitron/lock.py +++ b/homeassistant/components/lockitron/lock.py @@ -4,9 +4,9 @@ import logging import requests import voluptuous as vol -import homeassistant.helpers.config_validation as cv -from homeassistant.components.lock import LockDevice, PLATFORM_SCHEMA +from homeassistant.components.lock import PLATFORM_SCHEMA, LockDevice from homeassistant.const import CONF_ACCESS_TOKEN, CONF_ID +import homeassistant.helpers.config_validation as cv _LOGGER = logging.getLogger(__name__) diff --git a/homeassistant/components/logentries/__init__.py b/homeassistant/components/logentries/__init__.py index 3601ee275b85..55d1ab7aae6c 100644 --- a/homeassistant/components/logentries/__init__.py +++ b/homeassistant/components/logentries/__init__.py @@ -1,13 +1,13 @@ """Support for sending data to Logentries webhook endpoint.""" import json import logging -import requests +import requests import voluptuous as vol -import homeassistant.helpers.config_validation as cv from homeassistant.const import CONF_TOKEN, EVENT_STATE_CHANGED from homeassistant.helpers import state as state_helper +import homeassistant.helpers.config_validation as cv _LOGGER = logging.getLogger(__name__) diff --git a/homeassistant/components/logger/__init__.py b/homeassistant/components/logger/__init__.py index a2ed19f92b1c..8043469d43b3 100644 --- a/homeassistant/components/logger/__init__.py +++ b/homeassistant/components/logger/__init__.py @@ -1,6 +1,6 @@ """Support for settting the level of logging for components.""" -import logging from collections import OrderedDict +import logging import voluptuous as vol diff --git a/tests/components/litejet/test_init.py b/tests/components/litejet/test_init.py index 8dd1440a7bc5..3861e7a058eb 100644 --- a/tests/components/litejet/test_init.py +++ b/tests/components/litejet/test_init.py @@ -3,6 +3,7 @@ import logging import unittest from homeassistant.components import litejet + from tests.common import get_test_home_assistant _LOGGER = logging.getLogger(__name__) diff --git a/tests/components/logbook/test_init.py b/tests/components/logbook/test_init.py index 6ff043dff281..1b48f301529b 100644 --- a/tests/components/logbook/test_init.py +++ b/tests/components/logbook/test_init.py @@ -1,30 +1,13 @@ """The tests for the logbook component.""" # pylint: disable=protected-access,invalid-name +from datetime import datetime, timedelta import logging -from datetime import timedelta, datetime import unittest import pytest import voluptuous as vol -from homeassistant.components import sun -import homeassistant.core as ha -from homeassistant.const import ( - ATTR_ENTITY_ID, - ATTR_SERVICE, - ATTR_NAME, - EVENT_STATE_CHANGED, - EVENT_HOMEASSISTANT_START, - EVENT_HOMEASSISTANT_STOP, - EVENT_AUTOMATION_TRIGGERED, - EVENT_SCRIPT_STARTED, - ATTR_HIDDEN, - STATE_NOT_HOME, - STATE_ON, - STATE_OFF, -) -import homeassistant.util.dt as dt_util -from homeassistant.components import logbook, recorder +from homeassistant.components import logbook, recorder, sun from homeassistant.components.alexa.smart_home import EVENT_ALEXA_SMART_HOME from homeassistant.components.homekit.const import ( ATTR_DISPLAY_NAME, @@ -32,10 +15,25 @@ from homeassistant.components.homekit.const import ( DOMAIN as DOMAIN_HOMEKIT, EVENT_HOMEKIT_CHANGED, ) -from homeassistant.setup import setup_component, async_setup_component - -from tests.common import init_recorder_component, get_test_home_assistant +from homeassistant.const import ( + ATTR_ENTITY_ID, + ATTR_HIDDEN, + ATTR_NAME, + ATTR_SERVICE, + EVENT_AUTOMATION_TRIGGERED, + EVENT_HOMEASSISTANT_START, + EVENT_HOMEASSISTANT_STOP, + EVENT_SCRIPT_STARTED, + EVENT_STATE_CHANGED, + STATE_NOT_HOME, + STATE_OFF, + STATE_ON, +) +import homeassistant.core as ha +from homeassistant.setup import async_setup_component, setup_component +import homeassistant.util.dt as dt_util +from tests.common import get_test_home_assistant, init_recorder_component _LOGGER = logging.getLogger(__name__) diff --git a/tests/components/logentries/test_init.py b/tests/components/logentries/test_init.py index 8c69ec5ff87d..7125822e93e0 100644 --- a/tests/components/logentries/test_init.py +++ b/tests/components/logentries/test_init.py @@ -3,9 +3,9 @@ import unittest from unittest import mock -from homeassistant.setup import setup_component import homeassistant.components.logentries as logentries -from homeassistant.const import STATE_ON, STATE_OFF, EVENT_STATE_CHANGED +from homeassistant.const import EVENT_STATE_CHANGED, STATE_OFF, STATE_ON +from homeassistant.setup import setup_component from tests.common import get_test_home_assistant diff --git a/tests/components/logger/test_init.py b/tests/components/logger/test_init.py index eac6060a5bc0..00fa5aa35580 100644 --- a/tests/components/logger/test_init.py +++ b/tests/components/logger/test_init.py @@ -3,8 +3,8 @@ from collections import namedtuple import logging import unittest -from homeassistant.setup import setup_component from homeassistant.components import logger +from homeassistant.setup import setup_component from tests.common import get_test_home_assistant diff --git a/tests/components/logi_circle/test_config_flow.py b/tests/components/logi_circle/test_config_flow.py index 0e2ef29da94e..7ba3816b5e2b 100644 --- a/tests/components/logi_circle/test_config_flow.py +++ b/tests/components/logi_circle/test_config_flow.py @@ -8,8 +8,8 @@ from homeassistant import data_entry_flow from homeassistant.components.logi_circle import config_flow from homeassistant.components.logi_circle.config_flow import ( DOMAIN, - LogiCircleAuthCallbackView, AuthorizationFailed, + LogiCircleAuthCallbackView, ) from homeassistant.setup import async_setup_component diff --git a/tests/components/london_air/test_sensor.py b/tests/components/london_air/test_sensor.py index cd1ee32f2231..83405095f2ef 100644 --- a/tests/components/london_air/test_sensor.py +++ b/tests/components/london_air/test_sensor.py @@ -1,10 +1,12 @@ """The tests for the tube_state platform.""" import unittest + import requests_mock from homeassistant.components.london_air.sensor import CONF_LOCATIONS, URL from homeassistant.setup import setup_component -from tests.common import load_fixture, get_test_home_assistant + +from tests.common import get_test_home_assistant, load_fixture VALID_CONFIG = {"platform": "london_air", CONF_LOCATIONS: ["Merton"]} diff --git a/tests/components/lovelace/test_init.py b/tests/components/lovelace/test_init.py index 16aab911fb0a..e8d041e9dfae 100644 --- a/tests/components/lovelace/test_init.py +++ b/tests/components/lovelace/test_init.py @@ -1,10 +1,10 @@ """Test the Lovelace initialization.""" from unittest.mock import patch -from homeassistant.setup import async_setup_component from homeassistant.components import frontend, lovelace +from homeassistant.setup import async_setup_component -from tests.common import get_system_health_info, async_capture_events +from tests.common import async_capture_events, get_system_health_info async def test_lovelace_from_storage(hass, hass_ws_client, hass_storage):