Don't import stdlib typing types from helpers.typing (#49104)

pull/49425/head
Marc Mueller 2021-04-12 18:43:14 +02:00 committed by GitHub
parent f5545badac
commit 106dc4d28a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 42 additions and 24 deletions

View File

@ -1,4 +1,5 @@
"""Support for EDL21 Smart Meters."""
from __future__ import annotations
from datetime import timedelta
import logging
@ -16,7 +17,6 @@ from homeassistant.helpers.dispatcher import (
async_dispatcher_send,
)
from homeassistant.helpers.entity_registry import async_get_registry
from homeassistant.helpers.typing import Optional
from homeassistant.util.dt import utcnow
_LOGGER = logging.getLogger(__name__)
@ -258,7 +258,7 @@ class EDL21Entity(SensorEntity):
return self._obis
@property
def name(self) -> Optional[str]:
def name(self) -> str | None:
"""Return a name."""
return self._name

View File

@ -1,4 +1,5 @@
"""Representation of ISYEntity Types."""
from __future__ import annotations
from pyisy.constants import (
COMMAND_FRIENDLY_NAME,
@ -11,7 +12,6 @@ from pyisy.helpers import NodeProperty
from homeassistant.const import STATE_OFF, STATE_ON
from homeassistant.helpers.entity import Entity
from homeassistant.helpers.typing import Dict
from .const import _LOGGER, DOMAIN
@ -134,7 +134,7 @@ class ISYNodeEntity(ISYEntity):
"""Representation of a ISY Nodebase (Node/Group) entity."""
@property
def extra_state_attributes(self) -> Dict:
def extra_state_attributes(self) -> dict:
"""Get the state attributes for the device.
The 'aux_properties' in the pyisy Node class are combined with the
@ -186,7 +186,7 @@ class ISYProgramEntity(ISYEntity):
self._actions = actions
@property
def extra_state_attributes(self) -> Dict:
def extra_state_attributes(self) -> dict:
"""Get the state attributes for the device."""
attr = {}
if self._actions:

View File

@ -1,4 +1,6 @@
"""Config flow for Kodi integration."""
from __future__ import annotations
import logging
from pykodi import CannotConnectError, InvalidAuthError, Kodi, get_kodi_connection
@ -16,7 +18,7 @@ from homeassistant.const import (
)
from homeassistant.core import callback
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 (
CONF_WS_PORT,
@ -90,14 +92,14 @@ class KodiConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
def __init__(self):
"""Initialize flow."""
self._host: Optional[str] = None
self._port: Optional[int] = DEFAULT_PORT
self._ws_port: Optional[int] = DEFAULT_WS_PORT
self._name: Optional[str] = None
self._username: Optional[str] = None
self._password: Optional[str] = None
self._ssl: Optional[bool] = DEFAULT_SSL
self._discovery_name: Optional[str] = None
self._host: str | None = None
self._port: int | None = DEFAULT_PORT
self._ws_port: int | None = DEFAULT_WS_PORT
self._name: str | None = None
self._username: str | None = None
self._password: str | None = None
self._ssl: bool | None = DEFAULT_SSL
self._discovery_name: str | None = None
async def async_step_zeroconf(self, discovery_info: DiscoveryInfoType):
"""Handle zeroconf discovery."""

View File

@ -1,12 +1,16 @@
"""The tests for the Command line Binary sensor platform."""
from __future__ import annotations
from typing import Any
from homeassistant import setup
from homeassistant.components.binary_sensor import DOMAIN
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(
hass: HomeAssistantType, config_dict: Dict[str, Any]
hass: HomeAssistantType, config_dict: dict[str, Any]
) -> None:
"""Set up a test command line binary_sensor entity."""
assert await setup.async_setup_component(

View File

@ -1,6 +1,9 @@
"""The tests the cover command line platform."""
from __future__ import annotations
import os
import tempfile
from typing import Any
from unittest.mock import patch
from homeassistant import config as hass_config, setup
@ -12,14 +15,14 @@ from homeassistant.const import (
SERVICE_RELOAD,
SERVICE_STOP_COVER,
)
from homeassistant.helpers.typing import Any, Dict, HomeAssistantType
from homeassistant.helpers.typing import HomeAssistantType
import homeassistant.util.dt as dt_util
from tests.common import async_fire_time_changed
async def setup_test_entity(
hass: HomeAssistantType, config_dict: Dict[str, Any]
hass: HomeAssistantType, config_dict: dict[str, Any]
) -> None:
"""Set up a test command line notify service."""
assert await setup.async_setup_component(

View File

@ -1,16 +1,19 @@
"""The tests for the command line notification platform."""
from __future__ import annotations
import os
import subprocess
import tempfile
from typing import Any
from unittest.mock import patch
from homeassistant import setup
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(
hass: HomeAssistantType, config_dict: Dict[str, Any]
hass: HomeAssistantType, config_dict: dict[str, Any]
) -> None:
"""Set up a test command line notify service."""
assert await setup.async_setup_component(

View File

@ -1,13 +1,16 @@
"""The tests for the Command line sensor platform."""
from __future__ import annotations
from typing import Any
from unittest.mock import patch
from homeassistant import setup
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(
hass: HomeAssistantType, config_dict: Dict[str, Any]
hass: HomeAssistantType, config_dict: dict[str, Any]
) -> None:
"""Set up a test command line sensor entity."""
assert await setup.async_setup_component(

View File

@ -1,8 +1,11 @@
"""The tests for the Command line switch platform."""
from __future__ import annotations
import json
import os
import subprocess
import tempfile
from typing import Any
from unittest.mock import patch
from homeassistant import setup
@ -14,14 +17,14 @@ from homeassistant.const import (
STATE_OFF,
STATE_ON,
)
from homeassistant.helpers.typing import Any, Dict, HomeAssistantType
from homeassistant.helpers.typing import HomeAssistantType
import homeassistant.util.dt as dt_util
from tests.common import async_fire_time_changed
async def setup_test_entity(
hass: HomeAssistantType, config_dict: Dict[str, Any]
hass: HomeAssistantType, config_dict: dict[str, Any]
) -> None:
"""Set up a test command line switch entity."""
assert await setup.async_setup_component(