mirror of
https://github.com/home-assistant/core.git
synced 2025-07-22 20:57:21 +00:00
Don't import stdlib typing types from helpers.typing (#49104)
This commit is contained in:
parent
f5545badac
commit
106dc4d28a
@ -1,4 +1,5 @@
|
|||||||
"""Support for EDL21 Smart Meters."""
|
"""Support for EDL21 Smart Meters."""
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
from datetime import timedelta
|
from datetime import timedelta
|
||||||
import logging
|
import logging
|
||||||
@ -16,7 +17,6 @@ from homeassistant.helpers.dispatcher import (
|
|||||||
async_dispatcher_send,
|
async_dispatcher_send,
|
||||||
)
|
)
|
||||||
from homeassistant.helpers.entity_registry import async_get_registry
|
from homeassistant.helpers.entity_registry import async_get_registry
|
||||||
from homeassistant.helpers.typing import Optional
|
|
||||||
from homeassistant.util.dt import utcnow
|
from homeassistant.util.dt import utcnow
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
@ -258,7 +258,7 @@ class EDL21Entity(SensorEntity):
|
|||||||
return self._obis
|
return self._obis
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def name(self) -> Optional[str]:
|
def name(self) -> str | None:
|
||||||
"""Return a name."""
|
"""Return a name."""
|
||||||
return self._name
|
return self._name
|
||||||
|
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
"""Representation of ISYEntity Types."""
|
"""Representation of ISYEntity Types."""
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
from pyisy.constants import (
|
from pyisy.constants import (
|
||||||
COMMAND_FRIENDLY_NAME,
|
COMMAND_FRIENDLY_NAME,
|
||||||
@ -11,7 +12,6 @@ from pyisy.helpers import NodeProperty
|
|||||||
|
|
||||||
from homeassistant.const import STATE_OFF, STATE_ON
|
from homeassistant.const import STATE_OFF, STATE_ON
|
||||||
from homeassistant.helpers.entity import Entity
|
from homeassistant.helpers.entity import Entity
|
||||||
from homeassistant.helpers.typing import Dict
|
|
||||||
|
|
||||||
from .const import _LOGGER, DOMAIN
|
from .const import _LOGGER, DOMAIN
|
||||||
|
|
||||||
@ -134,7 +134,7 @@ class ISYNodeEntity(ISYEntity):
|
|||||||
"""Representation of a ISY Nodebase (Node/Group) entity."""
|
"""Representation of a ISY Nodebase (Node/Group) entity."""
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def extra_state_attributes(self) -> Dict:
|
def extra_state_attributes(self) -> dict:
|
||||||
"""Get the state attributes for the device.
|
"""Get the state attributes for the device.
|
||||||
|
|
||||||
The 'aux_properties' in the pyisy Node class are combined with the
|
The 'aux_properties' in the pyisy Node class are combined with the
|
||||||
@ -186,7 +186,7 @@ class ISYProgramEntity(ISYEntity):
|
|||||||
self._actions = actions
|
self._actions = actions
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def extra_state_attributes(self) -> Dict:
|
def extra_state_attributes(self) -> dict:
|
||||||
"""Get the state attributes for the device."""
|
"""Get the state attributes for the device."""
|
||||||
attr = {}
|
attr = {}
|
||||||
if self._actions:
|
if self._actions:
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
"""Config flow for Kodi integration."""
|
"""Config flow for Kodi integration."""
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
from pykodi import CannotConnectError, InvalidAuthError, Kodi, get_kodi_connection
|
from pykodi import CannotConnectError, InvalidAuthError, Kodi, get_kodi_connection
|
||||||
@ -16,7 +18,7 @@ from homeassistant.const import (
|
|||||||
)
|
)
|
||||||
from homeassistant.core import callback
|
from homeassistant.core import callback
|
||||||
from homeassistant.helpers.aiohttp_client import async_get_clientsession
|
from homeassistant.helpers.aiohttp_client import async_get_clientsession
|
||||||
from homeassistant.helpers.typing import DiscoveryInfoType, Optional
|
from homeassistant.helpers.typing import DiscoveryInfoType
|
||||||
|
|
||||||
from .const import (
|
from .const import (
|
||||||
CONF_WS_PORT,
|
CONF_WS_PORT,
|
||||||
@ -90,14 +92,14 @@ class KodiConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
|||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
"""Initialize flow."""
|
"""Initialize flow."""
|
||||||
self._host: Optional[str] = None
|
self._host: str | None = None
|
||||||
self._port: Optional[int] = DEFAULT_PORT
|
self._port: int | None = DEFAULT_PORT
|
||||||
self._ws_port: Optional[int] = DEFAULT_WS_PORT
|
self._ws_port: int | None = DEFAULT_WS_PORT
|
||||||
self._name: Optional[str] = None
|
self._name: str | None = None
|
||||||
self._username: Optional[str] = None
|
self._username: str | None = None
|
||||||
self._password: Optional[str] = None
|
self._password: str | None = None
|
||||||
self._ssl: Optional[bool] = DEFAULT_SSL
|
self._ssl: bool | None = DEFAULT_SSL
|
||||||
self._discovery_name: Optional[str] = None
|
self._discovery_name: str | None = None
|
||||||
|
|
||||||
async def async_step_zeroconf(self, discovery_info: DiscoveryInfoType):
|
async def async_step_zeroconf(self, discovery_info: DiscoveryInfoType):
|
||||||
"""Handle zeroconf discovery."""
|
"""Handle zeroconf discovery."""
|
||||||
|
@ -1,12 +1,16 @@
|
|||||||
"""The tests for the Command line Binary sensor platform."""
|
"""The tests for the Command line Binary sensor platform."""
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
|
from typing import Any
|
||||||
|
|
||||||
from homeassistant import setup
|
from homeassistant import setup
|
||||||
from homeassistant.components.binary_sensor import DOMAIN
|
from homeassistant.components.binary_sensor import DOMAIN
|
||||||
from homeassistant.const import STATE_OFF, STATE_ON
|
from homeassistant.const import STATE_OFF, STATE_ON
|
||||||
from homeassistant.helpers.typing import Any, Dict, HomeAssistantType
|
from homeassistant.helpers.typing import HomeAssistantType
|
||||||
|
|
||||||
|
|
||||||
async def setup_test_entity(
|
async def setup_test_entity(
|
||||||
hass: HomeAssistantType, config_dict: Dict[str, Any]
|
hass: HomeAssistantType, config_dict: dict[str, Any]
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Set up a test command line binary_sensor entity."""
|
"""Set up a test command line binary_sensor entity."""
|
||||||
assert await setup.async_setup_component(
|
assert await setup.async_setup_component(
|
||||||
|
@ -1,6 +1,9 @@
|
|||||||
"""The tests the cover command line platform."""
|
"""The tests the cover command line platform."""
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import tempfile
|
import tempfile
|
||||||
|
from typing import Any
|
||||||
from unittest.mock import patch
|
from unittest.mock import patch
|
||||||
|
|
||||||
from homeassistant import config as hass_config, setup
|
from homeassistant import config as hass_config, setup
|
||||||
@ -12,14 +15,14 @@ from homeassistant.const import (
|
|||||||
SERVICE_RELOAD,
|
SERVICE_RELOAD,
|
||||||
SERVICE_STOP_COVER,
|
SERVICE_STOP_COVER,
|
||||||
)
|
)
|
||||||
from homeassistant.helpers.typing import Any, Dict, HomeAssistantType
|
from homeassistant.helpers.typing import HomeAssistantType
|
||||||
import homeassistant.util.dt as dt_util
|
import homeassistant.util.dt as dt_util
|
||||||
|
|
||||||
from tests.common import async_fire_time_changed
|
from tests.common import async_fire_time_changed
|
||||||
|
|
||||||
|
|
||||||
async def setup_test_entity(
|
async def setup_test_entity(
|
||||||
hass: HomeAssistantType, config_dict: Dict[str, Any]
|
hass: HomeAssistantType, config_dict: dict[str, Any]
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Set up a test command line notify service."""
|
"""Set up a test command line notify service."""
|
||||||
assert await setup.async_setup_component(
|
assert await setup.async_setup_component(
|
||||||
|
@ -1,16 +1,19 @@
|
|||||||
"""The tests for the command line notification platform."""
|
"""The tests for the command line notification platform."""
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import subprocess
|
import subprocess
|
||||||
import tempfile
|
import tempfile
|
||||||
|
from typing import Any
|
||||||
from unittest.mock import patch
|
from unittest.mock import patch
|
||||||
|
|
||||||
from homeassistant import setup
|
from homeassistant import setup
|
||||||
from homeassistant.components.notify import DOMAIN
|
from homeassistant.components.notify import DOMAIN
|
||||||
from homeassistant.helpers.typing import Any, Dict, HomeAssistantType
|
from homeassistant.helpers.typing import HomeAssistantType
|
||||||
|
|
||||||
|
|
||||||
async def setup_test_service(
|
async def setup_test_service(
|
||||||
hass: HomeAssistantType, config_dict: Dict[str, Any]
|
hass: HomeAssistantType, config_dict: dict[str, Any]
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Set up a test command line notify service."""
|
"""Set up a test command line notify service."""
|
||||||
assert await setup.async_setup_component(
|
assert await setup.async_setup_component(
|
||||||
|
@ -1,13 +1,16 @@
|
|||||||
"""The tests for the Command line sensor platform."""
|
"""The tests for the Command line sensor platform."""
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
|
from typing import Any
|
||||||
from unittest.mock import patch
|
from unittest.mock import patch
|
||||||
|
|
||||||
from homeassistant import setup
|
from homeassistant import setup
|
||||||
from homeassistant.components.sensor import DOMAIN
|
from homeassistant.components.sensor import DOMAIN
|
||||||
from homeassistant.helpers.typing import Any, Dict, HomeAssistantType
|
from homeassistant.helpers.typing import HomeAssistantType
|
||||||
|
|
||||||
|
|
||||||
async def setup_test_entities(
|
async def setup_test_entities(
|
||||||
hass: HomeAssistantType, config_dict: Dict[str, Any]
|
hass: HomeAssistantType, config_dict: dict[str, Any]
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Set up a test command line sensor entity."""
|
"""Set up a test command line sensor entity."""
|
||||||
assert await setup.async_setup_component(
|
assert await setup.async_setup_component(
|
||||||
|
@ -1,8 +1,11 @@
|
|||||||
"""The tests for the Command line switch platform."""
|
"""The tests for the Command line switch platform."""
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
import subprocess
|
import subprocess
|
||||||
import tempfile
|
import tempfile
|
||||||
|
from typing import Any
|
||||||
from unittest.mock import patch
|
from unittest.mock import patch
|
||||||
|
|
||||||
from homeassistant import setup
|
from homeassistant import setup
|
||||||
@ -14,14 +17,14 @@ from homeassistant.const import (
|
|||||||
STATE_OFF,
|
STATE_OFF,
|
||||||
STATE_ON,
|
STATE_ON,
|
||||||
)
|
)
|
||||||
from homeassistant.helpers.typing import Any, Dict, HomeAssistantType
|
from homeassistant.helpers.typing import HomeAssistantType
|
||||||
import homeassistant.util.dt as dt_util
|
import homeassistant.util.dt as dt_util
|
||||||
|
|
||||||
from tests.common import async_fire_time_changed
|
from tests.common import async_fire_time_changed
|
||||||
|
|
||||||
|
|
||||||
async def setup_test_entity(
|
async def setup_test_entity(
|
||||||
hass: HomeAssistantType, config_dict: Dict[str, Any]
|
hass: HomeAssistantType, config_dict: dict[str, Any]
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Set up a test command line switch entity."""
|
"""Set up a test command line switch entity."""
|
||||||
assert await setup.async_setup_component(
|
assert await setup.async_setup_component(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user