1
mirror of https://github.com/home-assistant/core synced 2024-08-02 23:40:32 +02:00

Use relative imports [S-Z] (#61576)

This commit is contained in:
Michael 2021-12-13 09:39:13 +01:00 committed by GitHub
parent 8f11bcf4cc
commit 90e52cd3ad
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
25 changed files with 57 additions and 71 deletions

View File

@ -22,10 +22,6 @@ from homeassistant.components.media_player.const import (
SUPPORT_VOLUME_MUTE,
SUPPORT_VOLUME_STEP,
)
from homeassistant.components.samsungtv.bridge import (
SamsungTVLegacyBridge,
SamsungTVWSBridge,
)
from homeassistant.config_entries import SOURCE_REAUTH, ConfigEntry
from homeassistant.const import CONF_HOST, CONF_MAC, CONF_NAME, STATE_OFF, STATE_ON
from homeassistant.core import HomeAssistant
@ -37,6 +33,7 @@ from homeassistant.helpers.entity_platform import AddEntitiesCallback
from homeassistant.helpers.script import Script
from homeassistant.util import dt as dt_util
from .bridge import SamsungTVLegacyBridge, SamsungTVWSBridge
from .const import (
CONF_MANUFACTURER,
CONF_MODEL,

View File

@ -17,7 +17,6 @@ from homeassistant.components.homeassistant.triggers.state import (
async_attach_trigger as async_attach_state_trigger,
async_validate_trigger_config as async_validate_state_trigger_config,
)
from homeassistant.components.select.const import ATTR_OPTIONS
from homeassistant.const import (
CONF_DEVICE_ID,
CONF_DOMAIN,
@ -31,6 +30,7 @@ from homeassistant.helpers.entity import get_capability
from homeassistant.helpers.typing import ConfigType
from . import DOMAIN
from .const import ATTR_OPTIONS
TRIGGER_TYPES = {"current_option_changed"}

View File

@ -6,11 +6,11 @@ from collections.abc import Iterable
import logging
from typing import Any
from homeassistant.components.select.const import ATTR_OPTIONS
from homeassistant.const import ATTR_ENTITY_ID
from homeassistant.core import Context, HomeAssistant, State
from . import ATTR_OPTION, DOMAIN, SERVICE_SELECT_OPTION
from .const import ATTR_OPTIONS
_LOGGER = logging.getLogger(__name__)

View File

@ -23,18 +23,6 @@ from homeassistant.components.recorder.models import (
StatisticMetaData,
StatisticResult,
)
from homeassistant.components.sensor import (
ATTR_STATE_CLASS,
DEVICE_CLASS_ENERGY,
DEVICE_CLASS_GAS,
DEVICE_CLASS_MONETARY,
DEVICE_CLASS_PRESSURE,
DEVICE_CLASS_TEMPERATURE,
STATE_CLASS_MEASUREMENT,
STATE_CLASS_TOTAL,
STATE_CLASS_TOTAL_INCREASING,
STATE_CLASSES,
)
from homeassistant.const import (
ATTR_DEVICE_CLASS,
ATTR_UNIT_OF_MEASUREMENT,
@ -65,7 +53,20 @@ import homeassistant.util.pressure as pressure_util
import homeassistant.util.temperature as temperature_util
import homeassistant.util.volume as volume_util
from . import ATTR_LAST_RESET, DOMAIN
from . import (
ATTR_LAST_RESET,
ATTR_STATE_CLASS,
DEVICE_CLASS_ENERGY,
DEVICE_CLASS_GAS,
DEVICE_CLASS_MONETARY,
DEVICE_CLASS_PRESSURE,
DEVICE_CLASS_TEMPERATURE,
DOMAIN,
STATE_CLASS_MEASUREMENT,
STATE_CLASS_TOTAL,
STATE_CLASS_TOTAL_INCREASING,
STATE_CLASSES,
)
_LOGGER = logging.getLogger(__name__)

View File

@ -17,12 +17,12 @@ from homeassistant.components.binary_sensor import (
STATE_ON,
BinarySensorEntity,
)
from homeassistant.components.shelly.const import CONF_SLEEP_PERIOD
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import ENTITY_CATEGORY_DIAGNOSTIC
from homeassistant.core import HomeAssistant
from homeassistant.helpers.entity_platform import AddEntitiesCallback
from .const import CONF_SLEEP_PERIOD
from .entity import (
BlockAttributeDescription,
RestAttributeDescription,

View File

@ -19,15 +19,13 @@ from homeassistant.components.climate.const import (
SUPPORT_PRESET_MODE,
SUPPORT_TARGET_TEMPERATURE,
)
from homeassistant.components.shelly import BlockDeviceWrapper
from homeassistant.components.shelly.entity import ShellyBlockEntity
from homeassistant.components.shelly.utils import get_device_entry_gen
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import ATTR_TEMPERATURE, TEMP_CELSIUS
from homeassistant.core import HomeAssistant
from homeassistant.helpers.entity_platform import AddEntitiesCallback
from homeassistant.helpers.restore_state import RestoreEntity
from . import BlockDeviceWrapper
from .const import (
AIOSHELLY_DEVICE_TIMEOUT_SEC,
BLOCK,
@ -35,6 +33,8 @@ from .const import (
DOMAIN,
SHTRV_01_TEMPERATURE_SETTINGS,
)
from .entity import ShellyBlockEntity
from .utils import get_device_entry_gen
_LOGGER: Final = logging.getLogger(__name__)

View File

@ -5,7 +5,8 @@ import logging
from requests import RequestException
from homeassistant.components.cover import ATTR_POSITION, CoverEntity
from homeassistant.components.soma import API, DEVICES, DOMAIN, SomaEntity
from . import API, DEVICES, DOMAIN, SomaEntity
_LOGGER = logging.getLogger(__name__)

View File

@ -4,7 +4,6 @@ from __future__ import annotations
from typing import Any, cast
from homeassistant.components.sensor import SensorEntity
from homeassistant.components.speedtestdotnet import SpeedTestDataCoordinator
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import ATTR_ATTRIBUTION
from homeassistant.core import HomeAssistant
@ -15,6 +14,7 @@ from homeassistant.helpers.restore_state import RestoreEntity
from homeassistant.helpers.typing import StateType
from homeassistant.helpers.update_coordinator import CoordinatorEntity
from . import SpeedTestDataCoordinator
from .const import (
ATTR_BYTES_RECEIVED,
ATTR_BYTES_SENT,

View File

@ -3,9 +3,10 @@
from datetime import timedelta
from homeassistant.components.binary_sensor import BinarySensorEntity
from homeassistant.components.streamlabswater import DOMAIN as STREAMLABSWATER_DOMAIN
from homeassistant.util import Throttle
from . import DOMAIN as STREAMLABSWATER_DOMAIN
DEPENDS = ["streamlabswater"]
MIN_TIME_BETWEEN_LOCATION_UPDATES = timedelta(seconds=60)

View File

@ -3,10 +3,11 @@
from datetime import timedelta
from homeassistant.components.sensor import SensorEntity
from homeassistant.components.streamlabswater import DOMAIN as STREAMLABSWATER_DOMAIN
from homeassistant.const import VOLUME_GALLONS
from homeassistant.util import Throttle
from . import DOMAIN as STREAMLABSWATER_DOMAIN
DEPENDENCIES = ["streamlabswater"]
WATER_ICON = "mdi:water"

View File

@ -7,12 +7,8 @@ from homeassistant.components.cover import (
DEVICE_CLASS_GARAGE,
CoverEntity,
)
from homeassistant.components.supla import (
DOMAIN,
SUPLA_COORDINATORS,
SUPLA_SERVERS,
SuplaChannel,
)
from . import DOMAIN, SUPLA_COORDINATORS, SUPLA_SERVERS, SuplaChannel
_LOGGER = logging.getLogger(__name__)

View File

@ -2,14 +2,10 @@
import logging
from pprint import pformat
from homeassistant.components.supla import (
DOMAIN,
SUPLA_COORDINATORS,
SUPLA_SERVERS,
SuplaChannel,
)
from homeassistant.components.switch import SwitchEntity
from . import DOMAIN, SUPLA_COORDINATORS, SUPLA_SERVERS, SuplaChannel
_LOGGER = logging.getLogger(__name__)

View File

@ -15,7 +15,6 @@ from homeassistant.components.binary_sensor import (
PLATFORM_SCHEMA,
BinarySensorEntity,
)
from homeassistant.components.template import TriggerUpdateCoordinator
from homeassistant.const import (
ATTR_ENTITY_ID,
ATTR_FRIENDLY_NAME,
@ -39,6 +38,7 @@ import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.entity import async_generate_entity_id
from homeassistant.helpers.event import async_call_later
from . import TriggerUpdateCoordinator
from .const import (
CONF_ATTRIBUTES,
CONF_AVAILABILITY,

View File

@ -17,7 +17,6 @@ from homeassistant.components.number.const import (
DEFAULT_MIN_VALUE,
DOMAIN as NUMBER_DOMAIN,
)
from homeassistant.components.template import TriggerUpdateCoordinator
from homeassistant.const import (
CONF_ICON,
CONF_NAME,
@ -31,6 +30,7 @@ from homeassistant.helpers.entity_platform import AddEntitiesCallback
from homeassistant.helpers.script import Script
from homeassistant.helpers.template import Template, TemplateError
from . import TriggerUpdateCoordinator
from .const import CONF_AVAILABILITY, DOMAIN
from .template_entity import TemplateEntity
from .trigger_entity import TriggerEntity

View File

@ -26,7 +26,6 @@ from aiounifi.events import (
from aiounifi.websocket import STATE_DISCONNECTED, STATE_RUNNING
import async_timeout
from homeassistant.components.unifi.switch import BLOCK_SWITCH, POE_SWITCH
from homeassistant.const import (
CONF_HOST,
CONF_PASSWORD,
@ -70,6 +69,7 @@ from .const import (
UNIFI_WIRELESS_CLIENTS,
)
from .errors import AuthenticationRequired, CannotConnect
from .switch import BLOCK_SWITCH, POE_SWITCH
RETRY_TIMER = 15
CHECK_HEARTBEAT_INTERVAL = timedelta(seconds=1)

View File

@ -11,7 +11,6 @@ from homeassistant.components.sensor import (
SensorEntity,
SensorEntityDescription,
)
from homeassistant.components.wallbox import WallboxCoordinator
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import (
DEVICE_CLASS_BATTERY,
@ -29,6 +28,7 @@ from homeassistant.helpers.entity_platform import AddEntitiesCallback
from homeassistant.helpers.typing import StateType
from homeassistant.helpers.update_coordinator import CoordinatorEntity
from . import WallboxCoordinator
from .const import (
CONF_ADDED_ENERGY_KEY,
CONF_ADDED_RANGE_KEY,

View File

@ -24,14 +24,6 @@ from homeassistant.components.media_player.const import (
SUPPORT_VOLUME_SET,
SUPPORT_VOLUME_STEP,
)
from homeassistant.components.webostv.const import (
ATTR_PAYLOAD,
ATTR_SOUND_OUTPUT,
CONF_ON_ACTION,
CONF_SOURCES,
DOMAIN,
LIVE_TV_APP_ID,
)
from homeassistant.const import (
ATTR_ENTITY_ID,
CONF_CUSTOMIZE,
@ -45,6 +37,15 @@ from homeassistant.const import (
from homeassistant.helpers.dispatcher import async_dispatcher_connect
from homeassistant.helpers.script import Script
from .const import (
ATTR_PAYLOAD,
ATTR_SOUND_OUTPUT,
CONF_ON_ACTION,
CONF_SOURCES,
DOMAIN,
LIVE_TV_APP_ID,
)
_LOGGER = logging.getLogger(__name__)
SUPPORT_WEBOSTV = (

View File

@ -10,7 +10,6 @@ import voluptuous as vol
from homeassistant.auth.permissions.const import CAT_ENTITIES, POLICY_READ
from homeassistant.bootstrap import SIGNAL_BOOTSTRAP_INTEGRATONS
from homeassistant.components.websocket_api.const import ERR_NOT_FOUND
from homeassistant.const import EVENT_STATE_CHANGED, EVENT_TIME_CHANGED, MATCH_ALL
from homeassistant.core import Context, Event, HomeAssistant, callback
from homeassistant.exceptions import (
@ -33,6 +32,7 @@ from homeassistant.setup import DATA_SETUP_TIME, async_get_loaded_integrations
from . import const, decorators, messages
from .connection import ActiveConnection
from .const import ERR_NOT_FOUND
@callback

View File

@ -6,11 +6,12 @@ import logging
import voluptuous as vol
from withings_api.common import AuthScope
from homeassistant.components.withings import const
from homeassistant.config_entries import SOURCE_REAUTH
from homeassistant.helpers import config_entry_oauth2_flow
from homeassistant.util import slugify
from . import const
class WithingsFlowHandler(
config_entry_oauth2_flow.AbstractOAuth2FlowHandler, domain=const.DOMAIN

View File

@ -3,15 +3,12 @@
from aiomusiccast.capabilities import NumberSetter
from homeassistant.components.number import NumberEntity
from homeassistant.components.yamaha_musiccast import (
DOMAIN,
MusicCastCapabilityEntity,
MusicCastDataUpdateCoordinator,
)
from homeassistant.config_entries import ConfigEntry
from homeassistant.core import HomeAssistant
from homeassistant.helpers.entity_platform import AddEntitiesCallback
from . import DOMAIN, MusicCastCapabilityEntity, MusicCastDataUpdateCoordinator
async def async_setup_entry(
hass: HomeAssistant,

View File

@ -3,15 +3,12 @@
from aiomusiccast.capabilities import OptionSetter
from homeassistant.components.select import SelectEntity
from homeassistant.components.yamaha_musiccast import (
DOMAIN,
MusicCastCapabilityEntity,
MusicCastDataUpdateCoordinator,
)
from homeassistant.config_entries import ConfigEntry
from homeassistant.core import HomeAssistant
from homeassistant.helpers.entity_platform import AddEntitiesCallback
from . import DOMAIN, MusicCastCapabilityEntity, MusicCastDataUpdateCoordinator
async def async_setup_entry(
hass: HomeAssistant,

View File

@ -9,7 +9,6 @@ from homeassistant.components.sensor import (
STATE_CLASS_TOTAL_INCREASING,
SensorEntity,
)
from homeassistant.components.youless import DOMAIN
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import (
CONF_DEVICE,
@ -29,6 +28,8 @@ from homeassistant.helpers.update_coordinator import (
DataUpdateCoordinator,
)
from . import DOMAIN
async def async_setup_entry(
hass: HomeAssistant, entry: ConfigEntry, async_add_entities: AddEntitiesCallback

View File

@ -11,7 +11,6 @@ from homeassistant.components.alarm_control_panel import (
SUPPORT_ALARM_TRIGGER,
AlarmControlPanelEntity,
)
from homeassistant.components.zha.core.typing import ZhaDeviceType
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import (
STATE_ALARM_ARMED_AWAY,
@ -42,6 +41,7 @@ from .core.const import (
)
from .core.helpers import async_get_zha_config_value
from .core.registries import ZHA_ENTITIES
from .core.typing import ZhaDeviceType
from .entity import ZhaEntity
STRICT_MATCH = functools.partial(

View File

@ -45,9 +45,6 @@ from homeassistant.components.climate.const import (
SUPPORT_TARGET_TEMPERATURE,
SUPPORT_TARGET_TEMPERATURE_RANGE,
)
from homeassistant.components.zwave_js.discovery_data_template import (
DynamicCurrentTempClimateDataTemplate,
)
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import (
ATTR_TEMPERATURE,
@ -62,6 +59,7 @@ from homeassistant.helpers.temperature import convert_temperature
from .const import DATA_CLIENT, DOMAIN
from .discovery import ZwaveDiscoveryInfo
from .discovery_data_template import DynamicCurrentTempClimateDataTemplate
from .entity import ZWaveBaseEntity
from .helpers import get_value_of_zwave_value

View File

@ -24,9 +24,6 @@ from homeassistant.components.sensor import (
SensorEntity,
SensorEntityDescription,
)
from homeassistant.components.zwave_js.discovery_data_template import (
NumericSensorDataTemplateData,
)
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import (
DEVICE_CLASS_BATTERY,
@ -75,6 +72,7 @@ from .const import (
SERVICE_RESET_METER,
)
from .discovery import ZwaveDiscoveryInfo
from .discovery_data_template import NumericSensorDataTemplateData
from .entity import ZWaveBaseEntity
from .helpers import get_device_id