Use relative imports [A-H] (#61574)

pull/61716/head
Michael 2021-12-13 20:03:01 +01:00 committed by GitHub
parent 237232dad6
commit b68a2747f3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
21 changed files with 57 additions and 67 deletions

View File

@ -5,13 +5,6 @@ from typing import Final
import voluptuous as vol
from homeassistant.components.alarm_control_panel.const import (
SUPPORT_ALARM_ARM_AWAY,
SUPPORT_ALARM_ARM_CUSTOM_BYPASS,
SUPPORT_ALARM_ARM_HOME,
SUPPORT_ALARM_ARM_NIGHT,
SUPPORT_ALARM_ARM_VACATION,
)
from homeassistant.const import (
ATTR_ENTITY_ID,
CONF_CONDITION,
@ -42,6 +35,11 @@ from .const import (
CONDITION_ARMED_VACATION,
CONDITION_DISARMED,
CONDITION_TRIGGERED,
SUPPORT_ALARM_ARM_AWAY,
SUPPORT_ALARM_ARM_CUSTOM_BYPASS,
SUPPORT_ALARM_ARM_HOME,
SUPPORT_ALARM_ARM_NIGHT,
SUPPORT_ALARM_ARM_VACATION,
)
CONDITION_TYPES: Final[set[str]] = {

View File

@ -5,12 +5,6 @@ from typing import Any, Final
import voluptuous as vol
from homeassistant.components.alarm_control_panel.const import (
SUPPORT_ALARM_ARM_AWAY,
SUPPORT_ALARM_ARM_HOME,
SUPPORT_ALARM_ARM_NIGHT,
SUPPORT_ALARM_ARM_VACATION,
)
from homeassistant.components.automation import (
AutomationActionType,
AutomationTriggerInfo,
@ -38,6 +32,12 @@ from homeassistant.helpers.entity import get_supported_features
from homeassistant.helpers.typing import ConfigType
from . import DOMAIN
from .const import (
SUPPORT_ALARM_ARM_AWAY,
SUPPORT_ALARM_ARM_HOME,
SUPPORT_ALARM_ARM_NIGHT,
SUPPORT_ALARM_ARM_VACATION,
)
BASIC_TRIGGER_TYPES: Final[set[str]] = {"triggered", "disarmed", "arming"}
TRIGGER_TYPES: Final[set[str]] = BASIC_TRIGGER_TYPES | {

View File

@ -17,7 +17,6 @@ from yalexs.doorbell import DoorbellDetail
from yalexs.lock import LockDoorStatus
from yalexs.util import update_lock_detail_from_activity
from homeassistant.components.august import AugustData
from homeassistant.components.binary_sensor import (
BinarySensorDeviceClass,
BinarySensorEntity,
@ -27,6 +26,7 @@ from homeassistant.core import callback
from homeassistant.helpers.entity import EntityCategory
from homeassistant.helpers.event import async_call_later
from . import AugustData
from .const import ACTIVITY_UPDATE_INTERVAL, DATA_AUGUST, DOMAIN
from .entity import AugustEntityMixin

View File

@ -10,7 +10,6 @@ from yalexs.activity import ActivityType
from yalexs.keypad import KeypadDetail
from yalexs.lock import LockDetail
from homeassistant.components.august import AugustData
from homeassistant.components.sensor import (
SensorDeviceClass,
SensorEntity,
@ -22,6 +21,7 @@ from homeassistant.helpers.entity import EntityCategory
from homeassistant.helpers.entity_registry import async_get_registry
from homeassistant.helpers.restore_state import RestoreEntity
from . import AugustData
from .const import (
ATTR_OPERATION_AUTORELOCK,
ATTR_OPERATION_KEYPAD,

View File

@ -5,7 +5,6 @@ from python_awair.air_data import AirData
from python_awair.devices import AwairDevice
import voluptuous as vol
from homeassistant.components.awair import AwairDataUpdateCoordinator, AwairResult
from homeassistant.components.sensor import PLATFORM_SCHEMA, SensorEntity
from homeassistant.config_entries import SOURCE_IMPORT, ConfigEntry
from homeassistant.const import (
@ -21,6 +20,7 @@ from homeassistant.helpers.entity import DeviceInfo
from homeassistant.helpers.entity_platform import AddEntitiesCallback
from homeassistant.helpers.update_coordinator import CoordinatorEntity
from . import AwairDataUpdateCoordinator, AwairResult
from .const import (
API_DUST,
API_PM25,

View File

@ -3,14 +3,10 @@ from aioazuredevops.client import DevOpsClient
import aiohttp
import voluptuous as vol
from homeassistant.components.azure_devops.const import (
CONF_ORG,
CONF_PAT,
CONF_PROJECT,
DOMAIN,
)
from homeassistant.config_entries import ConfigFlow
from .const import CONF_ORG, CONF_PAT, CONF_PROJECT, DOMAIN
class AzureDevOpsFlowHandler(ConfigFlow, domain=DOMAIN):
"""Handle a Azure DevOps config flow."""

View File

@ -7,17 +7,15 @@ from typing import Any
from aioazuredevops.builds import DevOpsBuild
from homeassistant.components.azure_devops import (
AzureDevOpsDeviceEntity,
AzureDevOpsEntityDescription,
)
from homeassistant.components.azure_devops.const import CONF_ORG, DOMAIN
from homeassistant.components.sensor import SensorEntity, SensorEntityDescription
from homeassistant.config_entries import ConfigEntry
from homeassistant.core import HomeAssistant
from homeassistant.helpers.entity_platform import AddEntitiesCallback
from homeassistant.helpers.typing import StateType
from . import AzureDevOpsDeviceEntity, AzureDevOpsEntityDescription
from .const import CONF_ORG, DOMAIN
@dataclass
class AzureDevOpsSensorEntityDescriptionMixin:

View File

@ -6,11 +6,6 @@ from blinkpy.blinkpy import Blink, BlinkSetupError
import voluptuous as vol
from homeassistant import config_entries, core, exceptions
from homeassistant.components.blink.const import (
DEFAULT_SCAN_INTERVAL,
DEVICE_ID,
DOMAIN,
)
from homeassistant.const import (
CONF_PASSWORD,
CONF_PIN,
@ -19,6 +14,8 @@ from homeassistant.const import (
)
from homeassistant.core import callback
from .const import DEFAULT_SCAN_INTERVAL, DEVICE_ID, DOMAIN
_LOGGER = logging.getLogger(__name__)

View File

@ -6,12 +6,6 @@ from collections.abc import Iterable
import logging
from typing import Any
from homeassistant.components.cover import (
ATTR_CURRENT_POSITION,
ATTR_CURRENT_TILT_POSITION,
ATTR_POSITION,
ATTR_TILT_POSITION,
)
from homeassistant.const import (
ATTR_ENTITY_ID,
SERVICE_CLOSE_COVER,
@ -27,7 +21,13 @@ from homeassistant.const import (
)
from homeassistant.core import Context, HomeAssistant, State
from . import DOMAIN
from . import (
ATTR_CURRENT_POSITION,
ATTR_CURRENT_TILT_POSITION,
ATTR_POSITION,
ATTR_TILT_POSITION,
DOMAIN,
)
_LOGGER = logging.getLogger(__name__)

View File

@ -19,7 +19,6 @@ import voluptuous as vol
from homeassistant import config_entries
from homeassistant.components import ssdp
from homeassistant.components.deconz.gateway import DeconzGateway
from homeassistant.components.hassio import HassioServiceInfo
from homeassistant.config_entries import ConfigEntry, ConfigFlow, OptionsFlow
from homeassistant.const import CONF_API_KEY, CONF_HOST, CONF_PORT
@ -36,7 +35,7 @@ from .const import (
DOMAIN,
LOGGER,
)
from .gateway import get_gateway_from_config_entry
from .gateway import DeconzGateway, get_gateway_from_config_entry
DECONZ_MANUFACTURERURL = "http://www.dresden-elektronik.de"
CONF_SERIAL = "serial"

View File

@ -5,7 +5,6 @@ from types import MappingProxyType
from pydeconz.utils import normalize_bridge_id
import voluptuous as vol
from homeassistant.components.deconz.gateway import DeconzGateway
from homeassistant.core import HomeAssistant, ServiceCall, callback
from homeassistant.helpers import (
config_validation as cv,
@ -20,6 +19,7 @@ from homeassistant.helpers.entity_registry import (
from .config_flow import get_master_gateway
from .const import CONF_BRIDGE_ID, DOMAIN, LOGGER
from .gateway import DeconzGateway
DECONZ_SERVICES = "deconz_services"

View File

@ -9,15 +9,6 @@ from homeassistant.components.automation import (
AutomationActionType,
AutomationTriggerInfo,
)
from homeassistant.components.device_automation.const import (
CONF_IS_OFF,
CONF_IS_ON,
CONF_TOGGLE,
CONF_TURN_OFF,
CONF_TURN_ON,
CONF_TURNED_OFF,
CONF_TURNED_ON,
)
from homeassistant.components.homeassistant.triggers import state as state_trigger
from homeassistant.const import (
ATTR_ENTITY_ID,
@ -33,6 +24,15 @@ from homeassistant.helpers.entity_registry import async_entries_for_device
from homeassistant.helpers.typing import ConfigType, TemplateVarsType
from . import DEVICE_TRIGGER_BASE_SCHEMA
from .const import (
CONF_IS_OFF,
CONF_IS_ON,
CONF_TOGGLE,
CONF_TURN_OFF,
CONF_TURN_ON,
CONF_TURNED_OFF,
CONF_TURNED_ON,
)
# mypy: allow-untyped-calls, allow-untyped-defs

View File

@ -1,12 +1,9 @@
"""Offer device oriented automation."""
import voluptuous as vol
from homeassistant.components.device_automation import (
DEVICE_TRIGGER_BASE_SCHEMA,
async_get_device_automation_platform,
)
from homeassistant.const import CONF_DOMAIN
from . import DEVICE_TRIGGER_BASE_SCHEMA, async_get_device_automation_platform
from .exceptions import InvalidDeviceAutomationConfig
# mypy: allow-untyped-defs, no-check-untyped-defs

View File

@ -4,13 +4,13 @@ from __future__ import annotations
from collections.abc import Callable
from typing import Any
from homeassistant.components.dynalite.bridge import DynaliteBridge
from homeassistant.config_entries import ConfigEntry
from homeassistant.core import HomeAssistant, callback
from homeassistant.helpers.dispatcher import async_dispatcher_connect
from homeassistant.helpers.entity import DeviceInfo, Entity
from homeassistant.helpers.entity_platform import AddEntitiesCallback
from .bridge import DynaliteBridge
from .const import DOMAIN, LOGGER

View File

@ -7,7 +7,6 @@ from re import sub
from pyefergy import Efergy, exceptions
import voluptuous as vol
from homeassistant.components.efergy import EfergyEntity
from homeassistant.components.sensor import (
PLATFORM_SCHEMA,
SensorDeviceClass,
@ -29,6 +28,7 @@ import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.entity_platform import AddEntitiesCallback
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
from . import EfergyEntity
from .const import CONF_APPTOKEN, CONF_CURRENT_VALUES, DATA_KEY_API, DOMAIN
_LOGGER = logging.getLogger(__name__)

View File

@ -18,12 +18,13 @@ from elmax_api.http import Elmax
from elmax_api.model.endpoint import DeviceEndpoint
from elmax_api.model.panel import PanelEntry, PanelStatus
from homeassistant.components.elmax.const import DEFAULT_TIMEOUT, DOMAIN
from homeassistant.exceptions import ConfigEntryAuthFailed, HomeAssistantError
from homeassistant.helpers.entity import Entity
from homeassistant.helpers.typing import HomeAssistantType
from homeassistant.helpers.update_coordinator import DataUpdateCoordinator
from .const import DEFAULT_TIMEOUT, DOMAIN
_LOGGER = logging.getLogger(__name__)

View File

@ -10,7 +10,10 @@ from elmax_api.model.panel import PanelEntry
import voluptuous as vol
from homeassistant import config_entries
from homeassistant.components.elmax.const import (
from homeassistant.data_entry_flow import FlowResult
from homeassistant.exceptions import HomeAssistantError
from .const import (
CONF_ELMAX_PANEL_ID,
CONF_ELMAX_PANEL_NAME,
CONF_ELMAX_PANEL_PIN,
@ -18,8 +21,6 @@ from homeassistant.components.elmax.const import (
CONF_ELMAX_USERNAME,
DOMAIN,
)
from homeassistant.data_entry_flow import FlowResult
from homeassistant.exceptions import HomeAssistantError
_LOGGER = logging.getLogger(__name__)

View File

@ -4,14 +4,15 @@ from typing import Any
from elmax_api.model.command import SwitchCommand
from elmax_api.model.panel import PanelStatus
from homeassistant.components.elmax import ElmaxCoordinator
from homeassistant.components.elmax.common import ElmaxEntity
from homeassistant.components.elmax.const import DOMAIN
from homeassistant.components.switch import SwitchEntity
from homeassistant.config_entries import ConfigEntry
from homeassistant.helpers.entity_platform import AddEntitiesCallback
from homeassistant.helpers.typing import HomeAssistantType
from . import ElmaxCoordinator
from .common import ElmaxEntity
from .const import DOMAIN
class ElmaxSwitch(ElmaxEntity, SwitchEntity):
"""Implement the Elmax switch entity."""

View File

@ -3,13 +3,14 @@ import logging
import voluptuous as vol
from homeassistant.components.geo_location import DOMAIN
from homeassistant.const import CONF_EVENT, CONF_PLATFORM, CONF_SOURCE, CONF_ZONE
from homeassistant.core import HassJob, callback
from homeassistant.helpers import condition, config_validation as cv
from homeassistant.helpers.config_validation import entity_domain
from homeassistant.helpers.event import TrackStates, async_track_state_change_filtered
from . import DOMAIN
# mypy: allow-untyped-defs, no-check-untyped-defs
_LOGGER = logging.getLogger(__name__)

View File

@ -3,10 +3,11 @@ from googlemaps import Client
from googlemaps.distance_matrix import distance_matrix
from googlemaps.exceptions import ApiError
from homeassistant.components.google_travel_time.const import TRACKABLE_DOMAINS
from homeassistant.const import ATTR_LATITUDE, ATTR_LONGITUDE
from homeassistant.helpers import location
from .const import TRACKABLE_DOMAINS
def is_valid_config_entry(hass, logger, api_key, origin, destination):
"""Return whether the config entry data is valid."""

View File

@ -2,9 +2,9 @@
import voluptuous as vol
from homeassistant import config_entries
from homeassistant.components.honeywell import get_somecomfort_client
from homeassistant.const import CONF_PASSWORD, CONF_USERNAME
from . import get_somecomfort_client
from .const import CONF_COOL_AWAY_TEMPERATURE, CONF_HEAT_AWAY_TEMPERATURE, DOMAIN