Misc typing improvements (#86550)
parent
0e9b74986f
commit
60b799aac9
|
@ -1,8 +1,9 @@
|
|||
"""Config helpers for Alexa."""
|
||||
from abc import ABC, abstractmethod
|
||||
import asyncio
|
||||
import logging
|
||||
|
||||
from homeassistant.core import callback
|
||||
from homeassistant.core import CALLBACK_TYPE, callback
|
||||
from homeassistant.helpers.storage import Store
|
||||
|
||||
from .const import DOMAIN
|
||||
|
@ -16,7 +17,7 @@ _LOGGER = logging.getLogger(__name__)
|
|||
class AbstractConfig(ABC):
|
||||
"""Hold the configuration for Alexa."""
|
||||
|
||||
_unsub_proactive_report = None
|
||||
_unsub_proactive_report: asyncio.Task[CALLBACK_TYPE] | None = None
|
||||
|
||||
def __init__(self, hass):
|
||||
"""Initialize abstract config."""
|
||||
|
|
|
@ -39,8 +39,8 @@ class AlmondFlowHandler(
|
|||
|
||||
DOMAIN = DOMAIN
|
||||
|
||||
host = None
|
||||
hassio_discovery = None
|
||||
host: str | None = None
|
||||
hassio_discovery: dict[str, Any] | None = None
|
||||
|
||||
@property
|
||||
def logger(self) -> logging.Logger:
|
||||
|
|
|
@ -63,7 +63,7 @@ class ComfoConnectFan(FanEntity):
|
|||
_attr_should_poll = False
|
||||
_attr_supported_features = FanEntityFeature.SET_SPEED | FanEntityFeature.PRESET_MODE
|
||||
_attr_preset_modes = PRESET_MODES
|
||||
current_speed = None
|
||||
current_speed: float | None = None
|
||||
|
||||
def __init__(self, ccb: ComfoConnectBridge) -> None:
|
||||
"""Initialize the ComfoConnect fan."""
|
||||
|
|
|
@ -17,7 +17,7 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
|||
|
||||
VERSION = 1
|
||||
|
||||
_options = None
|
||||
_options: dict[str, Any] | None = None
|
||||
|
||||
async def async_step_user(
|
||||
self, user_input: dict[str, Any] | None = None
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
"""Config flow for OctoPrint integration."""
|
||||
from __future__ import annotations
|
||||
|
||||
import asyncio
|
||||
from collections.abc import Mapping
|
||||
import logging
|
||||
from typing import Any
|
||||
|
@ -50,8 +51,8 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
|||
|
||||
VERSION = 1
|
||||
|
||||
api_key_task = None
|
||||
_reauth_data = None
|
||||
api_key_task: asyncio.Task[None] | None = None
|
||||
_reauth_data: dict[str, Any] | None = None
|
||||
|
||||
def __init__(self) -> None:
|
||||
"""Handle a config flow for OctoPrint."""
|
||||
|
|
|
@ -19,7 +19,7 @@ from .const import LOGGER
|
|||
from .models import Event
|
||||
from .parsers import PARSERS
|
||||
|
||||
UNHANDLED_TOPICS = set()
|
||||
UNHANDLED_TOPICS: set[str] = set()
|
||||
SUBSCRIPTION_ERRORS = (
|
||||
Fault,
|
||||
asyncio.TimeoutError,
|
||||
|
|
|
@ -3,6 +3,7 @@ from __future__ import annotations
|
|||
|
||||
import logging
|
||||
import telnetlib
|
||||
from typing import Final
|
||||
|
||||
import voluptuous as vol
|
||||
|
||||
|
@ -24,7 +25,7 @@ CONF_SOURCES = "sources"
|
|||
|
||||
DEFAULT_NAME = "Pioneer AVR"
|
||||
DEFAULT_PORT = 23 # telnet default. Some Pioneer AVRs use 8102
|
||||
DEFAULT_TIMEOUT = None
|
||||
DEFAULT_TIMEOUT: Final = None
|
||||
DEFAULT_SOURCES: dict[str, str] = {}
|
||||
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
from __future__ import annotations
|
||||
|
||||
import logging
|
||||
from typing import Any
|
||||
|
||||
from pyqwikswitch.qwikswitch import SENSORS
|
||||
|
||||
|
@ -34,7 +35,7 @@ async def async_setup_platform(
|
|||
class QSSensor(QSEntity, SensorEntity):
|
||||
"""Sensor based on a Qwikswitch relay/dimmer module."""
|
||||
|
||||
_val = None
|
||||
_val: Any | None = None
|
||||
|
||||
def __init__(self, sensor):
|
||||
"""Initialize the sensor."""
|
||||
|
|
|
@ -33,7 +33,7 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend(
|
|||
}
|
||||
)
|
||||
|
||||
TEMPER_SENSORS = []
|
||||
TEMPER_SENSORS: list[TemperSensor] = []
|
||||
|
||||
|
||||
def get_temper_devices():
|
||||
|
|
|
@ -35,7 +35,7 @@ _LOGGER = logging.getLogger(__name__)
|
|||
class YeelightScanner:
|
||||
"""Scan for Yeelight devices."""
|
||||
|
||||
_scanner = None
|
||||
_scanner: YeelightScanner | None = None
|
||||
|
||||
@classmethod
|
||||
@callback
|
||||
|
|
Loading…
Reference in New Issue