From 2abc9005ccefb0e942bd03df31aa5c1bb4485033 Mon Sep 17 00:00:00 2001 From: Bas Nijholt Date: Mon, 9 Dec 2019 09:38:24 +0100 Subject: [PATCH] use isort to sort imports according to PEP8 for homeassistant (#29718) --- .../components/homeassistant/__init__.py | 21 ++++++----- .../components/homeassistant/scene.py | 10 +++--- tests/components/homeassistant/test_init.py | 36 +++++++++---------- 3 files changed, 33 insertions(+), 34 deletions(-) diff --git a/homeassistant/components/homeassistant/__init__.py b/homeassistant/components/homeassistant/__init__.py index d2d6abdadb5..8aa1d7e020a 100644 --- a/homeassistant/components/homeassistant/__init__.py +++ b/homeassistant/components/homeassistant/__init__.py @@ -6,23 +6,22 @@ from typing import Awaitable import voluptuous as vol -import homeassistant.core as ha import homeassistant.config as conf_util -from homeassistant.exceptions import HomeAssistantError -from homeassistant.helpers.service import async_extract_entity_ids -from homeassistant.helpers import intent from homeassistant.const import ( ATTR_ENTITY_ID, - SERVICE_TURN_ON, - SERVICE_TURN_OFF, - SERVICE_TOGGLE, - SERVICE_HOMEASSISTANT_STOP, - SERVICE_HOMEASSISTANT_RESTART, - RESTART_EXIT_CODE, ATTR_LATITUDE, ATTR_LONGITUDE, + RESTART_EXIT_CODE, + SERVICE_HOMEASSISTANT_RESTART, + SERVICE_HOMEASSISTANT_STOP, + SERVICE_TOGGLE, + SERVICE_TURN_OFF, + SERVICE_TURN_ON, ) -from homeassistant.helpers import config_validation as cv +import homeassistant.core as ha +from homeassistant.exceptions import HomeAssistantError +from homeassistant.helpers import config_validation as cv, intent +from homeassistant.helpers.service import async_extract_entity_ids _LOGGER = logging.getLogger(__name__) DOMAIN = ha.DOMAIN diff --git a/homeassistant/components/homeassistant/scene.py b/homeassistant/components/homeassistant/scene.py index 576bf540e00..af271a069fe 100644 --- a/homeassistant/components/homeassistant/scene.py +++ b/homeassistant/components/homeassistant/scene.py @@ -4,6 +4,8 @@ import logging import voluptuous as vol +from homeassistant import config as conf_util +from homeassistant.components.scene import DOMAIN as SCENE_DOMAIN, STATES, Scene from homeassistant.const import ( ATTR_ENTITY_ID, ATTR_STATE, @@ -11,21 +13,19 @@ from homeassistant.const import ( CONF_ID, CONF_NAME, CONF_PLATFORM, + SERVICE_RELOAD, STATE_OFF, STATE_ON, - SERVICE_RELOAD, ) -from homeassistant.core import State, DOMAIN as HA_DOMAIN -from homeassistant import config as conf_util +from homeassistant.core import DOMAIN as HA_DOMAIN, State from homeassistant.exceptions import HomeAssistantError -from homeassistant.loader import async_get_integration from homeassistant.helpers import ( config_per_platform, config_validation as cv, entity_platform, ) from homeassistant.helpers.state import async_reproduce_state -from homeassistant.components.scene import DOMAIN as SCENE_DOMAIN, STATES, Scene +from homeassistant.loader import async_get_integration def _convert_states(states): diff --git a/tests/components/homeassistant/test_init.py b/tests/components/homeassistant/test_init.py index 7a97de0f68e..6c2b7f78e24 100644 --- a/tests/components/homeassistant/test_init.py +++ b/tests/components/homeassistant/test_init.py @@ -2,40 +2,40 @@ # pylint: disable=protected-access import asyncio import unittest -from unittest.mock import patch, Mock +from unittest.mock import Mock, patch import yaml -import homeassistant.core as ha from homeassistant import config -from homeassistant.const import ( - ATTR_ENTITY_ID, - STATE_ON, - STATE_OFF, - SERVICE_HOMEASSISTANT_RESTART, - SERVICE_HOMEASSISTANT_STOP, - SERVICE_TURN_ON, - SERVICE_TURN_OFF, - SERVICE_TOGGLE, - EVENT_CORE_CONFIG_UPDATE, -) import homeassistant.components as comps -from homeassistant.setup import async_setup_component from homeassistant.components.homeassistant import ( SERVICE_CHECK_CONFIG, SERVICE_RELOAD_CORE_CONFIG, ) -import homeassistant.helpers.intent as intent +from homeassistant.const import ( + ATTR_ENTITY_ID, + EVENT_CORE_CONFIG_UPDATE, + SERVICE_HOMEASSISTANT_RESTART, + SERVICE_HOMEASSISTANT_STOP, + SERVICE_TOGGLE, + SERVICE_TURN_OFF, + SERVICE_TURN_ON, + STATE_OFF, + STATE_ON, +) +import homeassistant.core as ha from homeassistant.exceptions import HomeAssistantError from homeassistant.helpers import entity +import homeassistant.helpers.intent as intent +from homeassistant.setup import async_setup_component from tests.common import ( + async_capture_events, + async_mock_service, get_test_home_assistant, + mock_coro, mock_service, patch_yaml_files, - mock_coro, - async_mock_service, - async_capture_events, )