mirror of
https://github.com/home-assistant/core.git
synced 2025-04-24 09:17:53 +00:00
Add constructor return type in integrations A-D (#50903)
This commit is contained in:
parent
b1138b1aab
commit
cf228e3fe5
@ -13,7 +13,7 @@ from .const import ACMEDA_ENTITY_REMOVE, DOMAIN, LOGGER
|
||||
class AcmedaBase(entity.Entity):
|
||||
"""Base representation of an Acmeda roller."""
|
||||
|
||||
def __init__(self, roller: aiopulse.Roller):
|
||||
def __init__(self, roller: aiopulse.Roller) -> None:
|
||||
"""Initialize the roller."""
|
||||
self.roller = roller
|
||||
|
||||
|
@ -136,7 +136,7 @@ class AirlyDataUpdateCoordinator(DataUpdateCoordinator):
|
||||
longitude: float,
|
||||
update_interval: timedelta,
|
||||
use_nearest: bool,
|
||||
):
|
||||
) -> None:
|
||||
"""Initialize."""
|
||||
self.latitude = latitude
|
||||
self.longitude = longitude
|
||||
|
@ -140,7 +140,7 @@ class AlarmDecoderFlowHandler(config_entries.ConfigFlow, domain=DOMAIN):
|
||||
class AlarmDecoderOptionsFlowHandler(config_entries.OptionsFlow):
|
||||
"""Handle AlarmDecoder options."""
|
||||
|
||||
def __init__(self, config_entry: config_entries.ConfigEntry):
|
||||
def __init__(self, config_entry: config_entries.ConfigEntry) -> None:
|
||||
"""Initialize AlarmDecoder options flow."""
|
||||
self.arm_options = config_entry.options.get(OPTIONS_ARM, DEFAULT_ARM_OPTIONS)
|
||||
self.zone_options = config_entry.options.get(
|
||||
|
@ -73,7 +73,7 @@ class AlexaCapability:
|
||||
|
||||
supported_locales = {"en-US"}
|
||||
|
||||
def __init__(self, entity: State, instance: str | None = None):
|
||||
def __init__(self, entity: State, instance: str | None = None) -> None:
|
||||
"""Initialize an Alexa capability."""
|
||||
self.entity = entity
|
||||
self.instance = instance
|
||||
|
@ -254,7 +254,9 @@ class AlexaEntity:
|
||||
The API handlers should manipulate entities only through this interface.
|
||||
"""
|
||||
|
||||
def __init__(self, hass: HomeAssistant, config: AbstractConfig, entity: State):
|
||||
def __init__(
|
||||
self, hass: HomeAssistant, config: AbstractConfig, entity: State
|
||||
) -> None:
|
||||
"""Initialize Alexa Entity."""
|
||||
self.hass = hass
|
||||
self.config = config
|
||||
|
@ -231,7 +231,7 @@ class AlmondOAuth(AbstractAlmondWebAuth):
|
||||
host: str,
|
||||
websession: ClientSession,
|
||||
oauth_session: config_entry_oauth2_flow.OAuth2Session,
|
||||
):
|
||||
) -> None:
|
||||
"""Initialize Almond auth."""
|
||||
super().__init__(host, websession)
|
||||
self._oauth_session = oauth_session
|
||||
@ -249,7 +249,7 @@ class AlmondAgent(conversation.AbstractConversationAgent):
|
||||
|
||||
def __init__(
|
||||
self, hass: HomeAssistant, api: WebAlmondAPI, entry: config_entries.ConfigEntry
|
||||
):
|
||||
) -> None:
|
||||
"""Initialize the agent."""
|
||||
self.hass = hass
|
||||
self.api = api
|
||||
|
@ -33,7 +33,7 @@ def get_scanner(hass, config):
|
||||
class ArrisDeviceScanner(DeviceScanner):
|
||||
"""This class queries a Arris TG2492LG router for connected devices."""
|
||||
|
||||
def __init__(self, connect_box: ConnectBox):
|
||||
def __init__(self, connect_box: ConnectBox) -> None:
|
||||
"""Initialize the scanner."""
|
||||
self.connect_box = connect_box
|
||||
self.last_results: list[Device] = []
|
||||
|
@ -184,7 +184,7 @@ class AsusWrtFlowHandler(config_entries.ConfigFlow, domain=DOMAIN):
|
||||
class OptionsFlowHandler(config_entries.OptionsFlow):
|
||||
"""Handle a option flow for AsusWrt."""
|
||||
|
||||
def __init__(self, config_entry: config_entries.ConfigEntry):
|
||||
def __init__(self, config_entry: config_entries.ConfigEntry) -> None:
|
||||
"""Initialize options flow."""
|
||||
self.config_entry = config_entry
|
||||
|
||||
|
@ -77,7 +77,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||
class AtomeData:
|
||||
"""Stores data retrieved from Neurio sensor."""
|
||||
|
||||
def __init__(self, client: AtomeClient):
|
||||
def __init__(self, client: AtomeClient) -> None:
|
||||
"""Initialize the data."""
|
||||
self.atome_client = client
|
||||
self._live_power = None
|
||||
|
@ -95,7 +95,7 @@ class AuroraDataUpdateCoordinator(DataUpdateCoordinator):
|
||||
latitude: float,
|
||||
longitude: float,
|
||||
threshold: float,
|
||||
):
|
||||
) -> None:
|
||||
"""Initialize the data updater."""
|
||||
|
||||
super().__init__(
|
||||
@ -128,7 +128,7 @@ class AuroraEntity(CoordinatorEntity):
|
||||
coordinator: AuroraDataUpdateCoordinator,
|
||||
name: str,
|
||||
icon: str,
|
||||
):
|
||||
) -> None:
|
||||
"""Initialize the Aurora Entity."""
|
||||
|
||||
super().__init__(coordinator=coordinator)
|
||||
|
@ -21,7 +21,7 @@ class AutomationTrace(ActionTrace):
|
||||
config: dict[str, Any],
|
||||
blueprint_inputs: dict[str, Any],
|
||||
context: Context,
|
||||
):
|
||||
) -> None:
|
||||
"""Container for automation trace."""
|
||||
key = ("automation", item_id)
|
||||
super().__init__(key, config, blueprint_inputs, context)
|
||||
|
@ -109,7 +109,7 @@ class AzureDevOpsLatestBuildSensor(AzureDevOpsSensor):
|
||||
|
||||
def __init__(
|
||||
self, client: DevOpsClient, organization: str, project: str, build: DevOpsBuild
|
||||
):
|
||||
) -> None:
|
||||
"""Initialize Azure DevOps sensor."""
|
||||
self.build: DevOpsBuild = build
|
||||
super().__init__(
|
||||
|
@ -102,7 +102,7 @@ class AzureEventHub:
|
||||
entities_filter: vol.Schema,
|
||||
send_interval: int,
|
||||
max_delay: int,
|
||||
):
|
||||
) -> None:
|
||||
"""Initialize the listener."""
|
||||
self.hass = hass
|
||||
self.queue = asyncio.PriorityQueue()
|
||||
|
@ -45,7 +45,7 @@ class InvalidBlueprint(BlueprintWithNameException):
|
||||
blueprint_name: str,
|
||||
blueprint_data: Any,
|
||||
msg_or_exc: vol.Invalid,
|
||||
):
|
||||
) -> None:
|
||||
"""Initialize an invalid blueprint error."""
|
||||
if isinstance(msg_or_exc, vol.Invalid):
|
||||
msg_or_exc = humanize_error(blueprint_data, msg_or_exc)
|
||||
@ -61,7 +61,7 @@ class InvalidBlueprint(BlueprintWithNameException):
|
||||
class InvalidBlueprintInputs(BlueprintException):
|
||||
"""When we encountered invalid blueprint inputs."""
|
||||
|
||||
def __init__(self, domain: str, msg: str):
|
||||
def __init__(self, domain: str, msg: str) -> None:
|
||||
"""Initialize an invalid blueprint inputs error."""
|
||||
super().__init__(
|
||||
domain,
|
||||
|
@ -74,7 +74,7 @@ class Bmp280Sensor(SensorEntity):
|
||||
name: str,
|
||||
unit_of_measurement: str,
|
||||
device_class: str,
|
||||
):
|
||||
) -> None:
|
||||
"""Initialize the sensor."""
|
||||
self._bmp280 = bmp280
|
||||
self._name = name
|
||||
@ -112,7 +112,7 @@ class Bmp280Sensor(SensorEntity):
|
||||
class Bmp280TemperatureSensor(Bmp280Sensor):
|
||||
"""Representation of a Bosch BMP280 Temperature Sensor."""
|
||||
|
||||
def __init__(self, bmp280: Adafruit_BMP280_I2C, name: str):
|
||||
def __init__(self, bmp280: Adafruit_BMP280_I2C, name: str) -> None:
|
||||
"""Initialize the entity."""
|
||||
super().__init__(
|
||||
bmp280, f"{name} Temperature", TEMP_CELSIUS, DEVICE_CLASS_TEMPERATURE
|
||||
@ -137,7 +137,7 @@ class Bmp280TemperatureSensor(Bmp280Sensor):
|
||||
class Bmp280PressureSensor(Bmp280Sensor):
|
||||
"""Representation of a Bosch BMP280 Barometric Pressure Sensor."""
|
||||
|
||||
def __init__(self, bmp280: Adafruit_BMP280_I2C, name: str):
|
||||
def __init__(self, bmp280: Adafruit_BMP280_I2C, name: str) -> None:
|
||||
"""Initialize the entity."""
|
||||
super().__init__(
|
||||
bmp280, f"{name} Pressure", PRESSURE_HPA, DEVICE_CLASS_PRESSURE
|
||||
|
@ -179,7 +179,7 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
||||
class InputValidationError(exceptions.HomeAssistantError):
|
||||
"""Error to indicate we cannot proceed due to invalid input."""
|
||||
|
||||
def __init__(self, base: str):
|
||||
def __init__(self, base: str) -> None:
|
||||
"""Initialize with error base."""
|
||||
super().__init__()
|
||||
self.base = base
|
||||
|
@ -31,7 +31,7 @@ class BondEntity(Entity):
|
||||
device: BondDevice,
|
||||
bpup_subs: BPUPSubscriptions,
|
||||
sub_device: str | None = None,
|
||||
):
|
||||
) -> None:
|
||||
"""Initialize entity with API and device info."""
|
||||
self._hub = hub
|
||||
self._device = device
|
||||
|
@ -53,7 +53,9 @@ async def async_setup_entry(
|
||||
class BondFan(BondEntity, FanEntity):
|
||||
"""Representation of a Bond fan."""
|
||||
|
||||
def __init__(self, hub: BondHub, device: BondDevice, bpup_subs: BPUPSubscriptions):
|
||||
def __init__(
|
||||
self, hub: BondHub, device: BondDevice, bpup_subs: BPUPSubscriptions
|
||||
) -> None:
|
||||
"""Create HA entity representing Bond fan."""
|
||||
super().__init__(hub, device, bpup_subs)
|
||||
|
||||
|
@ -87,7 +87,7 @@ class BondBaseLight(BondEntity, LightEntity):
|
||||
device: BondDevice,
|
||||
bpup_subs: BPUPSubscriptions,
|
||||
sub_device: str | None = None,
|
||||
):
|
||||
) -> None:
|
||||
"""Create HA entity representing Bond light."""
|
||||
super().__init__(hub, device, bpup_subs, sub_device)
|
||||
self._light: int | None = None
|
||||
@ -112,7 +112,7 @@ class BondLight(BondBaseLight, BondEntity, LightEntity):
|
||||
device: BondDevice,
|
||||
bpup_subs: BPUPSubscriptions,
|
||||
sub_device: str | None = None,
|
||||
):
|
||||
) -> None:
|
||||
"""Create HA entity representing Bond light."""
|
||||
super().__init__(hub, device, bpup_subs, sub_device)
|
||||
self._brightness: int | None = None
|
||||
@ -193,7 +193,9 @@ class BondUpLight(BondBaseLight, BondEntity, LightEntity):
|
||||
class BondFireplace(BondEntity, LightEntity):
|
||||
"""Representation of a Bond-controlled fireplace."""
|
||||
|
||||
def __init__(self, hub: BondHub, device: BondDevice, bpup_subs: BPUPSubscriptions):
|
||||
def __init__(
|
||||
self, hub: BondHub, device: BondDevice, bpup_subs: BPUPSubscriptions
|
||||
) -> None:
|
||||
"""Create HA entity representing Bond fireplace."""
|
||||
super().__init__(hub, device, bpup_subs)
|
||||
|
||||
|
@ -38,7 +38,9 @@ async def async_setup_entry(
|
||||
class BondSwitch(BondEntity, SwitchEntity):
|
||||
"""Representation of a Bond generic device."""
|
||||
|
||||
def __init__(self, hub: BondHub, device: BondDevice, bpup_subs: BPUPSubscriptions):
|
||||
def __init__(
|
||||
self, hub: BondHub, device: BondDevice, bpup_subs: BPUPSubscriptions
|
||||
) -> None:
|
||||
"""Create HA entity representing Bond generic device (switch)."""
|
||||
super().__init__(hub, device, bpup_subs)
|
||||
|
||||
|
@ -103,7 +103,7 @@ class BondDevice:
|
||||
class BondHub:
|
||||
"""Hub device representing Bond Bridge."""
|
||||
|
||||
def __init__(self, bond: Bond):
|
||||
def __init__(self, bond: Bond) -> None:
|
||||
"""Initialize Bond Hub."""
|
||||
self.bond: Bond = bond
|
||||
self._bridge: dict[str, Any] = {}
|
||||
|
@ -93,7 +93,7 @@ class BSBLanClimate(ClimateEntity):
|
||||
entry_id: str,
|
||||
bsblan: BSBLan,
|
||||
info: Info,
|
||||
):
|
||||
) -> None:
|
||||
"""Initialize BSBLan climate device."""
|
||||
self._current_temperature: float | None = None
|
||||
self._available = True
|
||||
|
@ -17,7 +17,7 @@ _LOGGER = logging.getLogger(__name__)
|
||||
class CanaryDataUpdateCoordinator(DataUpdateCoordinator):
|
||||
"""Class to manage fetching Canary data."""
|
||||
|
||||
def __init__(self, hass: HomeAssistant, *, api: Api):
|
||||
def __init__(self, hass: HomeAssistant, *, api: Api) -> None:
|
||||
"""Initialize global Canary data updater."""
|
||||
self.canary = api
|
||||
update_interval = timedelta(seconds=30)
|
||||
|
@ -160,7 +160,7 @@ class CastDevice(MediaPlayerEntity):
|
||||
"elected leader" itself.
|
||||
"""
|
||||
|
||||
def __init__(self, cast_info: ChromecastInfo):
|
||||
def __init__(self, cast_info: ChromecastInfo) -> None:
|
||||
"""Initialize the cast device."""
|
||||
|
||||
self._cast_info = cast_info
|
||||
|
@ -94,7 +94,7 @@ async def _get_services(hass):
|
||||
class CloudOAuth2Implementation(config_entry_oauth2_flow.AbstractOAuth2Implementation):
|
||||
"""Cloud implementation of the OAuth2 flow."""
|
||||
|
||||
def __init__(self, hass: HomeAssistant, service: str):
|
||||
def __init__(self, hass: HomeAssistant, service: str) -> None:
|
||||
"""Initialize cloud OAuth2 implementation."""
|
||||
self.hass = hass
|
||||
self.service = service
|
||||
|
@ -42,7 +42,7 @@ class AlexaConfig(alexa_config.AbstractConfig):
|
||||
cloud_user: str,
|
||||
prefs: CloudPreferences,
|
||||
cloud: Cloud,
|
||||
):
|
||||
) -> None:
|
||||
"""Initialize the Alexa config."""
|
||||
super().__init__(hass)
|
||||
self._config = config
|
||||
|
@ -35,7 +35,7 @@ class CloudClient(Interface):
|
||||
websession: aiohttp.ClientSession,
|
||||
alexa_user_config: dict[str, Any],
|
||||
google_user_config: dict[str, Any],
|
||||
):
|
||||
) -> None:
|
||||
"""Initialize client interface to Cloud."""
|
||||
self._hass = hass
|
||||
self._prefs = prefs
|
||||
|
@ -61,7 +61,7 @@ async def async_get_engine(hass, config, discovery_info=None):
|
||||
class CloudProvider(Provider):
|
||||
"""NabuCasa Cloud speech API provider."""
|
||||
|
||||
def __init__(self, cloud: Cloud, language: str, gender: str):
|
||||
def __init__(self, cloud: Cloud, language: str, gender: str) -> None:
|
||||
"""Initialize cloud provider."""
|
||||
self.cloud = cloud
|
||||
self.name = "Cloud"
|
||||
|
@ -153,7 +153,7 @@ class Control4Entity(CoordinatorEntity):
|
||||
device_manufacturer: str,
|
||||
device_model: str,
|
||||
device_id: int,
|
||||
):
|
||||
) -> None:
|
||||
"""Initialize a Control4 entity."""
|
||||
super().__init__(coordinator)
|
||||
self.entry = entry
|
||||
|
@ -144,7 +144,7 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
||||
class OptionsFlowHandler(config_entries.OptionsFlow):
|
||||
"""Handle a option flow for Control4."""
|
||||
|
||||
def __init__(self, config_entry: config_entries.ConfigEntry):
|
||||
def __init__(self, config_entry: config_entries.ConfigEntry) -> None:
|
||||
"""Initialize options flow."""
|
||||
self.config_entry = config_entry
|
||||
|
||||
|
@ -150,7 +150,7 @@ class Control4Light(Control4Entity, LightEntity):
|
||||
device_model: str,
|
||||
device_id: int,
|
||||
is_dimmer: bool,
|
||||
):
|
||||
) -> None:
|
||||
"""Initialize Control4 light entity."""
|
||||
super().__init__(
|
||||
entry_data,
|
||||
|
@ -53,7 +53,7 @@ def async_register(hass, intent_type, utterances):
|
||||
class DefaultAgent(AbstractConversationAgent):
|
||||
"""Default agent for conversation agent."""
|
||||
|
||||
def __init__(self, hass: core.HomeAssistant):
|
||||
def __init__(self, hass: core.HomeAssistant) -> None:
|
||||
"""Initialize the default agent."""
|
||||
self.hass = hass
|
||||
|
||||
|
@ -173,7 +173,7 @@ class CounterStorageCollection(collection.StorageCollection):
|
||||
class Counter(RestoreEntity):
|
||||
"""Representation of a counter."""
|
||||
|
||||
def __init__(self, config: dict):
|
||||
def __init__(self, config: dict) -> None:
|
||||
"""Initialize a counter."""
|
||||
self._config: dict = config
|
||||
self._state: int | None = config[CONF_INITIAL]
|
||||
|
@ -86,7 +86,7 @@ async def daikin_api_setup(hass, host, key, uuid, password):
|
||||
class DaikinApi:
|
||||
"""Keep the Daikin instance in one place and centralize the update."""
|
||||
|
||||
def __init__(self, device: Appliance):
|
||||
def __init__(self, device: Appliance) -> None:
|
||||
"""Initialize the Daikin Handle."""
|
||||
self.device = device
|
||||
self.name = device.values.get("name", "Daikin AC")
|
||||
|
@ -45,7 +45,7 @@ CONFIG_SCHEMA = vol.Schema({vol.Optional(CONF_HOST): str})
|
||||
class OptionsFlowHandler(config_entries.OptionsFlow):
|
||||
"""Options for the component."""
|
||||
|
||||
def __init__(self, config_entry: config_entries.ConfigEntry):
|
||||
def __init__(self, config_entry: config_entries.ConfigEntry) -> None:
|
||||
"""Init object."""
|
||||
self.config_entry = config_entry
|
||||
|
||||
|
@ -142,7 +142,7 @@ class DenonDevice(MediaPlayerEntity):
|
||||
unique_id: str,
|
||||
config_entry: config_entries.ConfigEntry,
|
||||
update_audyssey: bool,
|
||||
):
|
||||
) -> None:
|
||||
"""Initialize the device."""
|
||||
self._receiver = receiver
|
||||
self._unique_id = unique_id
|
||||
|
@ -20,7 +20,7 @@ class ConnectDenonAVR:
|
||||
zone2: bool,
|
||||
zone3: bool,
|
||||
async_client_getter: Callable,
|
||||
):
|
||||
) -> None:
|
||||
"""Initialize the class."""
|
||||
self._async_client_getter = async_client_getter
|
||||
self._receiver = None
|
||||
|
@ -61,7 +61,7 @@ class DexcomConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
||||
class DexcomOptionsFlowHandler(config_entries.OptionsFlow):
|
||||
"""Handle a option flow for Dexcom."""
|
||||
|
||||
def __init__(self, config_entry: config_entries.ConfigEntry):
|
||||
def __init__(self, config_entry: config_entries.ConfigEntry) -> None:
|
||||
"""Initialize options flow."""
|
||||
self.config_entry = config_entry
|
||||
|
||||
|
@ -149,7 +149,7 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
||||
class OptionsFlowHandler(config_entries.OptionsFlow):
|
||||
"""Handle a option flow for doorbird."""
|
||||
|
||||
def __init__(self, config_entry: config_entries.ConfigEntry):
|
||||
def __init__(self, config_entry: config_entries.ConfigEntry) -> None:
|
||||
"""Initialize options flow."""
|
||||
self.config_entry = config_entry
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user