use isort to sort imports according to PEP8 for binary_sensor (#29622)

This commit is contained in:
Bas Nijholt 2019-12-08 17:32:08 +01:00 committed by Fabian Affolter
parent f5288db93c
commit 8f5e8c72c6
6 changed files with 24 additions and 23 deletions

View File

@ -5,14 +5,13 @@ import logging
import voluptuous as vol import voluptuous as vol
from homeassistant.helpers.entity_component import EntityComponent from homeassistant.const import STATE_OFF, STATE_ON
from homeassistant.helpers.entity import Entity
from homeassistant.const import STATE_ON, STATE_OFF
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,
) )
from homeassistant.helpers.entity import Entity
from homeassistant.helpers.entity_component import EntityComponent
# mypy: allow-untyped-defs, no-check-untyped-defs # mypy: allow-untyped-defs, no-check-untyped-defs

View File

@ -1,10 +1,11 @@
"""Implemenet device conditions for binary sensor.""" """Implemenet device conditions for binary sensor."""
from typing import Dict, List from typing import Dict, List
import voluptuous as vol import voluptuous as vol
from homeassistant.core import HomeAssistant
from homeassistant.components.device_automation.const import CONF_IS_OFF, CONF_IS_ON from homeassistant.components.device_automation.const import CONF_IS_OFF, CONF_IS_ON
from homeassistant.const import ATTR_DEVICE_CLASS, CONF_ENTITY_ID, CONF_FOR, CONF_TYPE from homeassistant.const import ATTR_DEVICE_CLASS, CONF_ENTITY_ID, CONF_FOR, CONF_TYPE
from homeassistant.core import HomeAssistant
from homeassistant.helpers import condition, config_validation as cv from homeassistant.helpers import condition, config_validation as cv
from homeassistant.helpers.entity_registry import ( from homeassistant.helpers.entity_registry import (
async_entries_for_device, async_entries_for_device,
@ -13,7 +14,6 @@ from homeassistant.helpers.entity_registry import (
from homeassistant.helpers.typing import ConfigType from homeassistant.helpers.typing import ConfigType
from . import ( from . import (
DOMAIN,
DEVICE_CLASS_BATTERY, DEVICE_CLASS_BATTERY,
DEVICE_CLASS_COLD, DEVICE_CLASS_COLD,
DEVICE_CLASS_CONNECTIVITY, DEVICE_CLASS_CONNECTIVITY,
@ -37,6 +37,7 @@ from . import (
DEVICE_CLASS_SOUND, DEVICE_CLASS_SOUND,
DEVICE_CLASS_VIBRATION, DEVICE_CLASS_VIBRATION,
DEVICE_CLASS_WINDOW, DEVICE_CLASS_WINDOW,
DOMAIN,
) )
DEVICE_CLASS_NONE = "none" DEVICE_CLASS_NONE = "none"

View File

@ -8,11 +8,10 @@ from homeassistant.components.device_automation.const import (
CONF_TURNED_ON, CONF_TURNED_ON,
) )
from homeassistant.const import ATTR_DEVICE_CLASS, CONF_ENTITY_ID, CONF_FOR, CONF_TYPE from homeassistant.const import ATTR_DEVICE_CLASS, CONF_ENTITY_ID, CONF_FOR, CONF_TYPE
from homeassistant.helpers.entity_registry import async_entries_for_device
from homeassistant.helpers import config_validation as cv from homeassistant.helpers import config_validation as cv
from homeassistant.helpers.entity_registry import async_entries_for_device
from . import ( from . import (
DOMAIN,
DEVICE_CLASS_BATTERY, DEVICE_CLASS_BATTERY,
DEVICE_CLASS_COLD, DEVICE_CLASS_COLD,
DEVICE_CLASS_CONNECTIVITY, DEVICE_CLASS_CONNECTIVITY,
@ -36,9 +35,9 @@ from . import (
DEVICE_CLASS_SOUND, DEVICE_CLASS_SOUND,
DEVICE_CLASS_VIBRATION, DEVICE_CLASS_VIBRATION,
DEVICE_CLASS_WINDOW, DEVICE_CLASS_WINDOW,
DOMAIN,
) )
# mypy: allow-untyped-defs, no-check-untyped-defs # mypy: allow-untyped-defs, no-check-untyped-defs
DEVICE_CLASS_NONE = "none" DEVICE_CLASS_NONE = "none"

View File

@ -1,23 +1,24 @@
"""The test for binary_sensor device automation.""" """The test for binary_sensor device automation."""
from datetime import timedelta from datetime import timedelta
import pytest
from unittest.mock import patch from unittest.mock import patch
from homeassistant.components.binary_sensor import DOMAIN, DEVICE_CLASSES import pytest
from homeassistant.components.binary_sensor.device_condition import ENTITY_CONDITIONS
from homeassistant.const import STATE_ON, STATE_OFF, CONF_PLATFORM
from homeassistant.setup import async_setup_component
import homeassistant.components.automation as automation import homeassistant.components.automation as automation
from homeassistant.components.binary_sensor import DEVICE_CLASSES, DOMAIN
from homeassistant.components.binary_sensor.device_condition import ENTITY_CONDITIONS
from homeassistant.const import CONF_PLATFORM, STATE_OFF, STATE_ON
from homeassistant.helpers import device_registry from homeassistant.helpers import device_registry
from homeassistant.setup import async_setup_component
import homeassistant.util.dt as dt_util import homeassistant.util.dt as dt_util
from tests.common import ( from tests.common import (
MockConfigEntry, MockConfigEntry,
async_get_device_automation_capabilities,
async_get_device_automations,
async_mock_service, async_mock_service,
mock_device_registry, mock_device_registry,
mock_registry, mock_registry,
async_get_device_automations,
async_get_device_automation_capabilities,
) )

View File

@ -1,23 +1,24 @@
"""The test for binary_sensor device automation.""" """The test for binary_sensor device automation."""
from datetime import timedelta from datetime import timedelta
import pytest import pytest
from homeassistant.components.binary_sensor import DOMAIN, DEVICE_CLASSES
from homeassistant.components.binary_sensor.device_trigger import ENTITY_TRIGGERS
from homeassistant.const import STATE_ON, STATE_OFF, CONF_PLATFORM
from homeassistant.setup import async_setup_component
import homeassistant.components.automation as automation import homeassistant.components.automation as automation
from homeassistant.components.binary_sensor import DEVICE_CLASSES, DOMAIN
from homeassistant.components.binary_sensor.device_trigger import ENTITY_TRIGGERS
from homeassistant.const import CONF_PLATFORM, STATE_OFF, STATE_ON
from homeassistant.helpers import device_registry from homeassistant.helpers import device_registry
from homeassistant.setup import async_setup_component
import homeassistant.util.dt as dt_util import homeassistant.util.dt as dt_util
from tests.common import ( from tests.common import (
MockConfigEntry, MockConfigEntry,
async_fire_time_changed, async_fire_time_changed,
async_get_device_automation_capabilities,
async_get_device_automations,
async_mock_service, async_mock_service,
mock_device_registry, mock_device_registry,
mock_registry, mock_registry,
async_get_device_automations,
async_get_device_automation_capabilities,
) )

View File

@ -3,7 +3,7 @@ import unittest
from unittest import mock from unittest import mock
from homeassistant.components import binary_sensor from homeassistant.components import binary_sensor
from homeassistant.const import STATE_ON, STATE_OFF from homeassistant.const import STATE_OFF, STATE_ON
class TestBinarySensor(unittest.TestCase): class TestBinarySensor(unittest.TestCase):