use isort to sort imports according to PEP8 for fan (#29632)

This commit is contained in:
Bas Nijholt 2019-12-08 16:58:47 +01:00 committed by Fabian Affolter
parent 57a3f7d5c8
commit a38f3ac9c6
10 changed files with 45 additions and 38 deletions

View File

@ -7,15 +7,15 @@ from typing import Optional
import voluptuous as vol import voluptuous as vol
from homeassistant.components import group from homeassistant.components import group
from homeassistant.const import SERVICE_TURN_ON, SERVICE_TOGGLE, SERVICE_TURN_OFF from homeassistant.const import SERVICE_TOGGLE, SERVICE_TURN_OFF, SERVICE_TURN_ON
from homeassistant.loader import bind_hass import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.entity import ToggleEntity
from homeassistant.helpers.entity_component import EntityComponent
from homeassistant.helpers.config_validation import ( # noqa: F401 from homeassistant.helpers.config_validation import ( # noqa: F401
PLATFORM_SCHEMA, PLATFORM_SCHEMA,
PLATFORM_SCHEMA_BASE, PLATFORM_SCHEMA_BASE,
) )
import homeassistant.helpers.config_validation as cv from homeassistant.helpers.entity import ToggleEntity
from homeassistant.helpers.entity_component import EntityComponent
from homeassistant.loader import bind_hass
_LOGGER = logging.getLogger(__name__) _LOGGER = logging.getLogger(__name__)

View File

@ -1,19 +1,21 @@
"""Provides device automations for Fan.""" """Provides device automations for Fan."""
from typing import Optional, List from typing import List, Optional
import voluptuous as vol import voluptuous as vol
from homeassistant.const import ( from homeassistant.const import (
ATTR_ENTITY_ID, ATTR_ENTITY_ID,
CONF_DOMAIN,
CONF_TYPE,
CONF_DEVICE_ID, CONF_DEVICE_ID,
CONF_DOMAIN,
CONF_ENTITY_ID, CONF_ENTITY_ID,
SERVICE_TURN_ON, CONF_TYPE,
SERVICE_TURN_OFF, SERVICE_TURN_OFF,
SERVICE_TURN_ON,
) )
from homeassistant.core import HomeAssistant, Context from homeassistant.core import Context, HomeAssistant
from homeassistant.helpers import entity_registry from homeassistant.helpers import entity_registry
import homeassistant.helpers.config_validation as cv import homeassistant.helpers.config_validation as cv
from . import DOMAIN from . import DOMAIN
ACTION_TYPES = {"turn_on", "turn_off"} ACTION_TYPES = {"turn_on", "turn_off"}

View File

@ -1,21 +1,23 @@
"""Provide the device automations for Fan.""" """Provide the device automations for Fan."""
from typing import Dict, List from typing import Dict, List
import voluptuous as vol import voluptuous as vol
from homeassistant.const import ( from homeassistant.const import (
ATTR_ENTITY_ID, ATTR_ENTITY_ID,
CONF_CONDITION, CONF_CONDITION,
CONF_DOMAIN,
CONF_TYPE,
CONF_DEVICE_ID, CONF_DEVICE_ID,
CONF_DOMAIN,
CONF_ENTITY_ID, CONF_ENTITY_ID,
CONF_TYPE,
STATE_OFF, STATE_OFF,
STATE_ON, STATE_ON,
) )
from homeassistant.core import HomeAssistant from homeassistant.core import HomeAssistant
from homeassistant.helpers import condition, config_validation as cv, entity_registry from homeassistant.helpers import condition, config_validation as cv, entity_registry
from homeassistant.helpers.typing import ConfigType, TemplateVarsType
from homeassistant.helpers.config_validation import DEVICE_CONDITION_BASE_SCHEMA from homeassistant.helpers.config_validation import DEVICE_CONDITION_BASE_SCHEMA
from homeassistant.helpers.typing import ConfigType, TemplateVarsType
from . import DOMAIN from . import DOMAIN
CONDITION_TYPES = {"is_on", "is_off"} CONDITION_TYPES = {"is_on", "is_off"}

View File

@ -1,21 +1,23 @@
"""Provides device automations for Fan.""" """Provides device automations for Fan."""
from typing import List from typing import List
import voluptuous as vol import voluptuous as vol
from homeassistant.components.automation import AutomationActionType, state
from homeassistant.components.device_automation import TRIGGER_BASE_SCHEMA
from homeassistant.const import ( from homeassistant.const import (
CONF_DOMAIN,
CONF_TYPE,
CONF_PLATFORM,
CONF_DEVICE_ID, CONF_DEVICE_ID,
CONF_DOMAIN,
CONF_ENTITY_ID, CONF_ENTITY_ID,
STATE_ON, CONF_PLATFORM,
CONF_TYPE,
STATE_OFF, STATE_OFF,
STATE_ON,
) )
from homeassistant.core import HomeAssistant, CALLBACK_TYPE from homeassistant.core import CALLBACK_TYPE, HomeAssistant
from homeassistant.helpers import config_validation as cv, entity_registry from homeassistant.helpers import config_validation as cv, entity_registry
from homeassistant.helpers.typing import ConfigType from homeassistant.helpers.typing import ConfigType
from homeassistant.components.automation import state, AutomationActionType
from homeassistant.components.device_automation import TRIGGER_BASE_SCHEMA
from . import DOMAIN from . import DOMAIN
TRIGGER_TYPES = {"turned_on", "turned_off"} TRIGGER_TYPES = {"turned_on", "turned_off"}

View File

@ -6,19 +6,19 @@ from typing import Iterable, Optional
from homeassistant.const import ( from homeassistant.const import (
ATTR_ENTITY_ID, ATTR_ENTITY_ID,
STATE_ON,
STATE_OFF,
SERVICE_TURN_OFF, SERVICE_TURN_OFF,
SERVICE_TURN_ON, SERVICE_TURN_ON,
STATE_OFF,
STATE_ON,
) )
from homeassistant.core import Context, State from homeassistant.core import Context, State
from homeassistant.helpers.typing import HomeAssistantType from homeassistant.helpers.typing import HomeAssistantType
from . import ( from . import (
DOMAIN,
ATTR_DIRECTION, ATTR_DIRECTION,
ATTR_OSCILLATING, ATTR_OSCILLATING,
ATTR_SPEED, ATTR_SPEED,
DOMAIN,
SERVICE_OSCILLATE, SERVICE_OSCILLATE,
SERVICE_SET_DIRECTION, SERVICE_SET_DIRECTION,
SERVICE_SET_SPEED, SERVICE_SET_SPEED,

View File

@ -5,8 +5,8 @@ components. Instead call the service directly.
""" """
from homeassistant.components.fan import ( from homeassistant.components.fan import (
ATTR_DIRECTION, ATTR_DIRECTION,
ATTR_SPEED,
ATTR_OSCILLATING, ATTR_OSCILLATING,
ATTR_SPEED,
DOMAIN, DOMAIN,
SERVICE_OSCILLATE, SERVICE_OSCILLATE,
SERVICE_SET_DIRECTION, SERVICE_SET_DIRECTION,
@ -14,9 +14,9 @@ from homeassistant.components.fan import (
) )
from homeassistant.const import ( from homeassistant.const import (
ATTR_ENTITY_ID, ATTR_ENTITY_ID,
SERVICE_TURN_ON,
SERVICE_TURN_OFF,
ENTITY_MATCH_ALL, ENTITY_MATCH_ALL,
SERVICE_TURN_OFF,
SERVICE_TURN_ON,
) )

View File

@ -1,18 +1,18 @@
"""The tests for Fan device actions.""" """The tests for Fan device actions."""
import pytest import pytest
from homeassistant.components.fan import DOMAIN
from homeassistant.setup import async_setup_component
import homeassistant.components.automation as automation import homeassistant.components.automation as automation
from homeassistant.components.fan import DOMAIN
from homeassistant.helpers import device_registry from homeassistant.helpers import device_registry
from homeassistant.setup import async_setup_component
from tests.common import ( from tests.common import (
MockConfigEntry, MockConfigEntry,
assert_lists_same, assert_lists_same,
async_get_device_automations,
async_mock_service, async_mock_service,
mock_device_registry, mock_device_registry,
mock_registry, mock_registry,
async_get_device_automations,
) )

View File

@ -1,19 +1,19 @@
"""The tests for Fan device conditions.""" """The tests for Fan device conditions."""
import pytest import pytest
from homeassistant.components.fan import DOMAIN
from homeassistant.const import STATE_ON, STATE_OFF
from homeassistant.setup import async_setup_component
import homeassistant.components.automation as automation import homeassistant.components.automation as automation
from homeassistant.components.fan import DOMAIN
from homeassistant.const import STATE_OFF, STATE_ON
from homeassistant.helpers import device_registry from homeassistant.helpers import device_registry
from homeassistant.setup import async_setup_component
from tests.common import ( from tests.common import (
MockConfigEntry, MockConfigEntry,
assert_lists_same, assert_lists_same,
async_get_device_automations,
async_mock_service, async_mock_service,
mock_device_registry, mock_device_registry,
mock_registry, mock_registry,
async_get_device_automations,
) )

View File

@ -1,19 +1,19 @@
"""The tests for Fan device triggers.""" """The tests for Fan device triggers."""
import pytest import pytest
from homeassistant.components.fan import DOMAIN
from homeassistant.const import STATE_ON, STATE_OFF
from homeassistant.setup import async_setup_component
import homeassistant.components.automation as automation import homeassistant.components.automation as automation
from homeassistant.components.fan import DOMAIN
from homeassistant.const import STATE_OFF, STATE_ON
from homeassistant.helpers import device_registry from homeassistant.helpers import device_registry
from homeassistant.setup import async_setup_component
from tests.common import ( from tests.common import (
MockConfigEntry, MockConfigEntry,
assert_lists_same, assert_lists_same,
async_get_device_automations,
async_mock_service, async_mock_service,
mock_device_registry, mock_device_registry,
mock_registry, mock_registry,
async_get_device_automations,
) )

View File

@ -2,9 +2,10 @@
import unittest import unittest
from homeassistant.components.fan import FanEntity
import pytest import pytest
from homeassistant.components.fan import FanEntity
class BaseFan(FanEntity): class BaseFan(FanEntity):
"""Implementation of the abstract FanEntity.""" """Implementation of the abstract FanEntity."""