Sort imports according to PEP8 for device_tracker (#29666)
This commit is contained in:
parent
27bd6ca1db
commit
01d651c67d
7 changed files with 34 additions and 33 deletions
|
@ -3,21 +3,19 @@ import asyncio
|
||||||
|
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.loader import bind_hass
|
|
||||||
from homeassistant.components import group
|
from homeassistant.components import group
|
||||||
|
from homeassistant.const import ATTR_GPS_ACCURACY, STATE_HOME
|
||||||
from homeassistant.helpers import discovery
|
from homeassistant.helpers import discovery
|
||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
from homeassistant.helpers.typing import GPSType, ConfigType, HomeAssistantType
|
|
||||||
|
|
||||||
from homeassistant.helpers.event import async_track_utc_time_change
|
from homeassistant.helpers.event import async_track_utc_time_change
|
||||||
from homeassistant.const import ATTR_GPS_ACCURACY, STATE_HOME
|
from homeassistant.helpers.typing import ConfigType, GPSType, HomeAssistantType
|
||||||
|
from homeassistant.loader import bind_hass
|
||||||
|
|
||||||
from . import legacy, setup
|
from . import legacy, setup
|
||||||
from .config_entry import ( # noqa: F401 pylint: disable=unused-import
|
from .config_entry import ( # noqa: F401 pylint: disable=unused-import
|
||||||
async_setup_entry,
|
async_setup_entry,
|
||||||
async_unload_entry,
|
async_unload_entry,
|
||||||
)
|
)
|
||||||
from .legacy import DeviceScanner # noqa: F401 pylint: disable=unused-import
|
|
||||||
from .const import (
|
from .const import (
|
||||||
ATTR_ATTRIBUTES,
|
ATTR_ATTRIBUTES,
|
||||||
ATTR_BATTERY,
|
ATTR_BATTERY,
|
||||||
|
@ -38,11 +36,12 @@ from .const import (
|
||||||
DEFAULT_TRACK_NEW,
|
DEFAULT_TRACK_NEW,
|
||||||
DOMAIN,
|
DOMAIN,
|
||||||
PLATFORM_TYPE_LEGACY,
|
PLATFORM_TYPE_LEGACY,
|
||||||
SOURCE_TYPE_BLUETOOTH_LE,
|
|
||||||
SOURCE_TYPE_BLUETOOTH,
|
SOURCE_TYPE_BLUETOOTH,
|
||||||
|
SOURCE_TYPE_BLUETOOTH_LE,
|
||||||
SOURCE_TYPE_GPS,
|
SOURCE_TYPE_GPS,
|
||||||
SOURCE_TYPE_ROUTER,
|
SOURCE_TYPE_ROUTER,
|
||||||
)
|
)
|
||||||
|
from .legacy import DeviceScanner # noqa: F401 pylint: disable=unused-import
|
||||||
|
|
||||||
ENTITY_ID_ALL_DEVICES = group.ENTITY_ID_FORMAT.format("all_devices")
|
ENTITY_ID_ALL_DEVICES = group.ENTITY_ID_FORMAT.format("all_devices")
|
||||||
|
|
||||||
|
|
|
@ -3,12 +3,12 @@ from typing import Optional
|
||||||
|
|
||||||
from homeassistant.components import zone
|
from homeassistant.components import zone
|
||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
STATE_NOT_HOME,
|
ATTR_BATTERY_LEVEL,
|
||||||
STATE_HOME,
|
|
||||||
ATTR_GPS_ACCURACY,
|
ATTR_GPS_ACCURACY,
|
||||||
ATTR_LATITUDE,
|
ATTR_LATITUDE,
|
||||||
ATTR_LONGITUDE,
|
ATTR_LONGITUDE,
|
||||||
ATTR_BATTERY_LEVEL,
|
STATE_HOME,
|
||||||
|
STATE_NOT_HOME,
|
||||||
)
|
)
|
||||||
from homeassistant.helpers.entity import Entity
|
from homeassistant.helpers.entity import Entity
|
||||||
from homeassistant.helpers.entity_component import EntityComponent
|
from homeassistant.helpers.entity_component import EntityComponent
|
||||||
|
|
|
@ -1,21 +1,23 @@
|
||||||
"""Provides device automations for Device tracker."""
|
"""Provides device automations for Device tracker."""
|
||||||
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,
|
||||||
STATE_NOT_HOME,
|
CONF_TYPE,
|
||||||
STATE_HOME,
|
STATE_HOME,
|
||||||
|
STATE_NOT_HOME,
|
||||||
)
|
)
|
||||||
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_home", "is_not_home"}
|
CONDITION_TYPES = {"is_home", "is_not_home"}
|
||||||
|
|
|
@ -1,27 +1,26 @@
|
||||||
"""Device tracker helpers."""
|
"""Device tracker helpers."""
|
||||||
import asyncio
|
import asyncio
|
||||||
from typing import Dict, Any, Callable, Optional
|
|
||||||
from types import ModuleType
|
from types import ModuleType
|
||||||
|
from typing import Any, Callable, Dict, Optional
|
||||||
|
|
||||||
import attr
|
import attr
|
||||||
|
|
||||||
from homeassistant.core import callback
|
|
||||||
from homeassistant.setup import async_prepare_setup_platform
|
|
||||||
from homeassistant.helpers import config_per_platform
|
|
||||||
from homeassistant.exceptions import HomeAssistantError
|
|
||||||
from homeassistant.helpers.typing import ConfigType, HomeAssistantType
|
|
||||||
from homeassistant.helpers.event import async_track_time_interval
|
|
||||||
from homeassistant.util import dt as dt_util
|
|
||||||
from homeassistant.const import ATTR_LATITUDE, ATTR_LONGITUDE
|
from homeassistant.const import ATTR_LATITUDE, ATTR_LONGITUDE
|
||||||
|
from homeassistant.core import callback
|
||||||
|
from homeassistant.exceptions import HomeAssistantError
|
||||||
|
from homeassistant.helpers import config_per_platform
|
||||||
|
from homeassistant.helpers.event import async_track_time_interval
|
||||||
|
from homeassistant.helpers.typing import ConfigType, HomeAssistantType
|
||||||
|
from homeassistant.setup import async_prepare_setup_platform
|
||||||
|
from homeassistant.util import dt as dt_util
|
||||||
|
|
||||||
from .const import (
|
from .const import (
|
||||||
DOMAIN,
|
|
||||||
PLATFORM_TYPE_LEGACY,
|
|
||||||
CONF_SCAN_INTERVAL,
|
CONF_SCAN_INTERVAL,
|
||||||
|
DOMAIN,
|
||||||
|
LOGGER,
|
||||||
|
PLATFORM_TYPE_LEGACY,
|
||||||
SCAN_INTERVAL,
|
SCAN_INTERVAL,
|
||||||
SOURCE_TYPE_ROUTER,
|
SOURCE_TYPE_ROUTER,
|
||||||
LOGGER,
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -4,15 +4,15 @@ All containing methods are legacy helpers that should not be used by new
|
||||||
components. Instead call the service directly.
|
components. Instead call the service directly.
|
||||||
"""
|
"""
|
||||||
from homeassistant.components.device_tracker import (
|
from homeassistant.components.device_tracker import (
|
||||||
DOMAIN,
|
|
||||||
ATTR_ATTRIBUTES,
|
ATTR_ATTRIBUTES,
|
||||||
ATTR_BATTERY,
|
ATTR_BATTERY,
|
||||||
|
ATTR_DEV_ID,
|
||||||
ATTR_GPS,
|
ATTR_GPS,
|
||||||
ATTR_GPS_ACCURACY,
|
ATTR_GPS_ACCURACY,
|
||||||
|
ATTR_HOST_NAME,
|
||||||
ATTR_LOCATION_NAME,
|
ATTR_LOCATION_NAME,
|
||||||
ATTR_MAC,
|
ATTR_MAC,
|
||||||
ATTR_DEV_ID,
|
DOMAIN,
|
||||||
ATTR_HOST_NAME,
|
|
||||||
SERVICE_SEE,
|
SERVICE_SEE,
|
||||||
)
|
)
|
||||||
from homeassistant.core import callback
|
from homeassistant.core import callback
|
||||||
|
|
|
@ -1,19 +1,19 @@
|
||||||
"""The tests for Device tracker device conditions."""
|
"""The tests for Device tracker device conditions."""
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
|
import homeassistant.components.automation as automation
|
||||||
from homeassistant.components.device_tracker import DOMAIN
|
from homeassistant.components.device_tracker import DOMAIN
|
||||||
from homeassistant.const import STATE_HOME, STATE_NOT_HOME
|
from homeassistant.const import STATE_HOME, STATE_NOT_HOME
|
||||||
from homeassistant.setup import async_setup_component
|
|
||||||
import homeassistant.components.automation as automation
|
|
||||||
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,
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -6,11 +6,12 @@ from homeassistant.components.device_tracker.config_entry import (
|
||||||
ScannerEntity,
|
ScannerEntity,
|
||||||
)
|
)
|
||||||
from homeassistant.components.device_tracker.const import (
|
from homeassistant.components.device_tracker.const import (
|
||||||
SOURCE_TYPE_ROUTER,
|
|
||||||
ATTR_SOURCE_TYPE,
|
ATTR_SOURCE_TYPE,
|
||||||
DOMAIN,
|
DOMAIN,
|
||||||
|
SOURCE_TYPE_ROUTER,
|
||||||
)
|
)
|
||||||
from homeassistant.const import STATE_HOME, STATE_NOT_HOME, ATTR_BATTERY_LEVEL
|
from homeassistant.const import ATTR_BATTERY_LEVEL, STATE_HOME, STATE_NOT_HOME
|
||||||
|
|
||||||
from tests.common import MockConfigEntry
|
from tests.common import MockConfigEntry
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue