Add constructor return type in integrations A-D (#50903)

This commit is contained in:
Shay Levy 2021-05-20 18:51:39 +03:00 committed by GitHub
parent b1138b1aab
commit cf228e3fe5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
39 changed files with 54 additions and 46 deletions

View File

@ -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

View File

@ -136,7 +136,7 @@ class AirlyDataUpdateCoordinator(DataUpdateCoordinator):
longitude: float,
update_interval: timedelta,
use_nearest: bool,
):
) -> None:
"""Initialize."""
self.latitude = latitude
self.longitude = longitude

View File

@ -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(

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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] = []

View File

@ -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

View File

@ -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

View File

@ -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)

View File

@ -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)

View File

@ -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__(

View File

@ -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()

View File

@ -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,

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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] = {}

View File

@ -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

View File

@ -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)

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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"

View File

@ -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

View File

@ -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

View File

@ -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,

View File

@ -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

View File

@ -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]

View File

@ -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")

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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