Add constructor return type in integrations E-K (#50902)

pull/50909/head
Michael 2021-05-20 17:47:30 +02:00 committed by GitHub
parent d7c0da90c5
commit b1138b1aab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
49 changed files with 64 additions and 60 deletions

View File

@ -37,7 +37,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
class EmonitorPowerSensor(CoordinatorEntity, SensorEntity):
"""Representation of an Emonitor power sensor entity."""
def __init__(self, coordinator: DataUpdateCoordinator, channel_number: int):
def __init__(self, coordinator: DataUpdateCoordinator, channel_number: int) -> None:
"""Initialize the channel sensor."""
self.channel_number = channel_number
super().__init__(coordinator)

View File

@ -150,7 +150,9 @@ class EnturProxy:
class EnturPublicTransportSensor(SensorEntity):
"""Implementation of a Entur public transport sensor."""
def __init__(self, api: EnturProxy, name: str, stop: str, show_on_map: bool):
def __init__(
self, api: EnturProxy, name: str, stop: str, show_on_map: bool
) -> None:
"""Initialize the sensor."""
self.api = api
self._stop = stop

View File

@ -724,7 +724,7 @@ def esphome_state_property(func):
class EsphomeEnumMapper:
"""Helper class to convert between hass and esphome enum values."""
def __init__(self, func: Callable[[], dict[int, str]]):
def __init__(self, func: Callable[[], dict[int, str]]) -> None:
"""Construct a EsphomeEnumMapper."""
self._func = func
@ -750,7 +750,7 @@ def esphome_map_enum(func: Callable[[], dict[int, str]]):
class EsphomeBaseEntity(Entity):
"""Define a base esphome entity."""
def __init__(self, entry_id: str, component_key: str, key: int):
def __init__(self, entry_id: str, component_key: str, key: int) -> None:
"""Initialize."""
self._entry_id = entry_id
self._component_key = component_key

View File

@ -32,7 +32,7 @@ async def async_setup_entry(
class EsphomeCamera(Camera, EsphomeBaseEntity):
"""A camera implementation for ESPHome."""
def __init__(self, entry_id: str, component_key: str, key: int):
def __init__(self, entry_id: str, component_key: str, key: int) -> None:
"""Initialize."""
Camera.__init__(self)
EsphomeBaseEntity.__init__(self, entry_id, component_key, key)

View File

@ -107,7 +107,7 @@ class FinTsClient:
Use this class as Context Manager to get the FinTS3Client object.
"""
def __init__(self, credentials: BankCredentials, name: str):
def __init__(self, credentials: BankCredentials, name: str) -> None:
"""Initialize a FinTsClient."""
self._credentials = credentials
self.name = name

View File

@ -32,7 +32,7 @@ FirmataPinType = Union[int, str]
class FirmataBoard:
"""Manages a single Firmata board."""
def __init__(self, config: dict):
def __init__(self, config: dict) -> None:
"""Initialize the board."""
self.config = config
self.api = None

View File

@ -37,7 +37,7 @@ class FirmataPinEntity(FirmataEntity):
config_entry: ConfigEntry,
name: str,
pin: FirmataPinType,
):
) -> None:
"""Initialize the pin entity."""
super().__init__(api)
self._name = name

View File

@ -59,7 +59,7 @@ class FirmataLight(FirmataPinEntity, LightEntity):
config_entry: ConfigEntry,
name: str,
pin: FirmataPinType,
):
) -> None:
"""Initialize the light pin entity."""
super().__init__(api, config_entry, name, pin)

View File

@ -15,7 +15,7 @@ class FirmataPinUsedException(Exception):
class FirmataBoardPin:
"""Manages a single Firmata board pin."""
def __init__(self, board: FirmataBoard, pin: FirmataPinType, pin_mode: str):
def __init__(self, board: FirmataBoard, pin: FirmataPinType, pin_mode: str) -> None:
"""Initialize the pin."""
self.board = board
self._pin = pin
@ -43,7 +43,7 @@ class FirmataBinaryDigitalOutput(FirmataBoardPin):
pin_mode: str,
initial: bool,
negate: bool,
):
) -> None:
"""Initialize the digital output pin."""
self._initial = initial
self._negate = negate
@ -98,7 +98,7 @@ class FirmataPWMOutput(FirmataBoardPin):
initial: bool,
minimum: int,
maximum: int,
):
) -> None:
"""Initialize the PWM/analog output pin."""
self._initial = initial
self._min = minimum
@ -139,7 +139,7 @@ class FirmataBinaryDigitalInput(FirmataBoardPin):
def __init__(
self, board: FirmataBoard, pin: FirmataPinType, pin_mode: str, negate: bool
):
) -> None:
"""Initialize the digital input pin."""
self._negate = negate
self._forward_callback = None
@ -206,7 +206,7 @@ class FirmataAnalogInput(FirmataBoardPin):
def __init__(
self, board: FirmataBoard, pin: FirmataPinType, pin_mode: str, differential: int
):
) -> None:
"""Initialize the analog input pin."""
self._differential = differential
self._forward_callback = None

View File

@ -47,7 +47,7 @@ async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry):
class HassFlickAuth(AbstractFlickAuth):
"""Implementation of AbstractFlickAuth based on a Home Assistant entity config."""
def __init__(self, hass: HomeAssistant, entry: ConfigEntry):
def __init__(self, hass: HomeAssistant, entry: ConfigEntry) -> None:
"""Flick authention based on a Home Assistant entity config."""
super().__init__(aiohttp_client.async_get_clientsession(hass))
self._entry = entry

View File

@ -36,7 +36,7 @@ async def async_setup_entry(
class FlickPricingSensor(SensorEntity):
"""Entity object for Flick Electric sensor."""
def __init__(self, api: FlickAPI):
def __init__(self, api: FlickAPI) -> None:
"""Entity object for Flick Electric sensor."""
self._api: FlickAPI = api
self._price: FlickPrice = None

View File

@ -21,7 +21,7 @@ class FloDeviceDataUpdateCoordinator(DataUpdateCoordinator):
def __init__(
self, hass: HomeAssistant, api_client: API, location_id: str, device_id: str
):
) -> None:
"""Initialize the device."""
self.hass: HomeAssistant = hass
self.api_client: API = api_client

View File

@ -19,7 +19,7 @@ class FloEntity(Entity):
name: str,
device: FloDeviceDataUpdateCoordinator,
**kwargs,
):
) -> None:
"""Init Flo entity."""
self._unique_id: str = f"{device.mac_address}_{entity_type}"
self._name: str = name

View File

@ -57,7 +57,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
class FloSwitch(FloEntity, SwitchEntity):
"""Switch class for the Flo by Moen valve."""
def __init__(self, device: FloDeviceDataUpdateCoordinator):
def __init__(self, device: FloDeviceDataUpdateCoordinator) -> None:
"""Initialize the Flo switch."""
super().__init__("shutoff_valve", "Shutoff Valve", device)
self._state = self._device.last_known_valve_state == "open"

View File

@ -51,7 +51,7 @@ class DeviceDataUpdateCoordinator(DataUpdateCoordinator):
update_interval: timedelta,
update_method: Callable[[], Awaitable] | None = None,
request_refresh_debouncer: Debouncer | None = None,
):
) -> None:
"""Initialize the data update coordinator."""
DataUpdateCoordinator.__init__(
self,

View File

@ -364,7 +364,7 @@ class RequestData:
source: str,
request_id: str,
devices: list[dict] | None,
):
) -> None:
"""Initialize the request data."""
self.config = config
self.source = source
@ -388,7 +388,9 @@ def get_google_type(domain, device_class):
class GoogleEntity:
"""Adaptation of Entity expressed in Google's terms."""
def __init__(self, hass: HomeAssistant, config: AbstractConfig, state: State):
def __init__(
self, hass: HomeAssistant, config: AbstractConfig, state: State
) -> None:
"""Initialize a Google entity."""
self.hass = hass
self.config = config

View File

@ -26,7 +26,7 @@ _LOGGER = logging.getLogger(__name__)
class DeviceDataUpdateCoordinator(DataUpdateCoordinator):
"""Manages polling for state changes from the device."""
def __init__(self, hass: HomeAssistant, device: Device):
def __init__(self, hass: HomeAssistant, device: Device) -> None:
"""Initialize the data update coordinator."""
DataUpdateCoordinator.__init__(
self,

View File

@ -86,7 +86,7 @@ class ValveControllerSwitch(ValveControllerEntity, SwitchEntity):
entry: ConfigEntry,
client: Client,
coordinators: dict[str, DataUpdateCoordinator],
):
) -> None:
"""Initialize."""
super().__init__(
entry, coordinators, "valve", "Valve Controller", None, "mdi:water"

View File

@ -29,7 +29,7 @@ class GuardianDataUpdateCoordinator(DataUpdateCoordinator[dict]):
api_coro: Callable[..., Awaitable],
api_lock: asyncio.Lock,
valve_controller_uid: str,
):
) -> None:
"""Initialize."""
super().__init__(
hass,

View File

@ -49,7 +49,7 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
VERSION = 1
def __init__(self):
def __init__(self) -> None:
"""Initialize the Harmony config flow."""
self.harmony_config = {}
@ -159,7 +159,7 @@ def _options_from_user_input(user_input):
class OptionsFlowHandler(config_entries.OptionsFlow):
"""Handle a option flow for Harmony."""
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

@ -34,7 +34,7 @@ def async_setup_auth_view(hass: HomeAssistant, user: User):
class HassIOBaseAuth(HomeAssistantView):
"""Hass.io view to handle auth requests."""
def __init__(self, hass: HomeAssistant, user: User):
def __init__(self, hass: HomeAssistant, user: User) -> None:
"""Initialize WebView."""
self.hass = hass
self.user = user

View File

@ -51,7 +51,7 @@ class HassIOView(HomeAssistantView):
url = "/api/hassio/{path:.+}"
requires_auth = False
def __init__(self, host: str, websession: aiohttp.ClientSession):
def __init__(self, host: str, websession: aiohttp.ClientSession) -> None:
"""Initialize a Hass.io base view."""
self._host = host
self._websession = websession

View File

@ -35,7 +35,7 @@ class HassIOIngress(HomeAssistantView):
url = "/api/hassio_ingress/{token}/{path:.*}"
requires_auth = False
def __init__(self, host: str, websession: aiohttp.ClientSession):
def __init__(self, host: str, websession: aiohttp.ClientSession) -> None:
"""Initialize a Hass.io ingress view."""
self._host = host
self._websession = websession

View File

@ -46,7 +46,7 @@ class ConfigEntryAuth(homeconnect.HomeConnectAPI):
hass: core.HomeAssistant,
config_entry: config_entries.ConfigEntry,
implementation: config_entry_oauth2_flow.AbstractOAuth2Implementation,
):
) -> None:
"""Initialize Home Connect Auth."""
self.hass = hass
self.config_entry = config_entry

View File

@ -27,7 +27,7 @@ class HomePlusControlOAuth2Implementation(
self,
hass: HomeAssistant,
config_data: dict,
):
) -> None:
"""HomePlusControlOAuth2Implementation Constructor.
Initialize the authentication implementation for the Legrand Home+ Control API.

View File

@ -65,7 +65,7 @@ class AccessoryAidStorage:
persist over reboots.
"""
def __init__(self, hass: HomeAssistant, entry: ConfigEntry):
def __init__(self, hass: HomeAssistant, entry: ConfigEntry) -> None:
"""Create a new entity map store."""
self.hass = hass
self.allocations = {}

View File

@ -113,7 +113,7 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
VERSION = 1
def __init__(self):
def __init__(self) -> None:
"""Initialize config flow."""
self.hk_data = {}
@ -263,7 +263,7 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
class OptionsFlowHandler(config_entries.OptionsFlow):
"""Handle a option flow for homekit."""
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
self.hk_options = {}

View File

@ -249,7 +249,7 @@ class ConfigFlowHandler(config_entries.ConfigFlow, domain=DOMAIN):
class OptionsFlowHandler(config_entries.OptionsFlow):
"""Huawei LTE options flow."""
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

@ -38,7 +38,7 @@ class HuisbaasjeSensor(CoordinatorEntity, SensorEntity):
unit_of_measurement: str = POWER_WATT,
icon: str = "mdi:lightning-bolt",
precision: int = 0,
):
) -> None:
"""Initialize the sensor."""
super().__init__(coordinator)
self._user_id = user_id

View File

@ -432,7 +432,7 @@ class HyperionConfigFlow(ConfigFlow, domain=DOMAIN):
class HyperionOptionsFlow(OptionsFlow):
"""Hyperion options flow."""
def __init__(self, config_entry: ConfigEntry):
def __init__(self, config_entry: ConfigEntry) -> None:
"""Initialize a Hyperion options flow."""
self._config_entry = config_entry

View File

@ -201,7 +201,7 @@ class AqualinkEntity(Entity):
class.
"""
def __init__(self, dev: AqualinkDevice):
def __init__(self, dev: AqualinkDevice) -> None:
"""Initialize the entity."""
self.dev = dev

View File

@ -85,7 +85,7 @@ class IcloudAccount:
max_interval: int,
gps_accuracy_threshold: int,
config_entry: ConfigEntry,
):
) -> None:
"""Initialize an iCloud account."""
self.hass = hass
self._username = username
@ -374,7 +374,7 @@ class IcloudAccount:
class IcloudDevice:
"""Representation of a iCloud device."""
def __init__(self, account: IcloudAccount, device: AppleDevice, status):
def __init__(self, account: IcloudAccount, device: AppleDevice, status) -> None:
"""Initialize the iCloud device."""
self._account = account

View File

@ -61,7 +61,7 @@ def add_entities(account, async_add_entities, tracked):
class IcloudTrackerEntity(TrackerEntity):
"""Represent a tracked device."""
def __init__(self, account: IcloudAccount, device: IcloudDevice):
def __init__(self, account: IcloudAccount, device: IcloudDevice) -> None:
"""Set up the iCloud tracker entity."""
self._account = account
self._device = device

View File

@ -53,7 +53,7 @@ def add_entities(account, async_add_entities, tracked):
class IcloudDeviceBatterySensor(SensorEntity):
"""Representation of a iCloud device battery sensor."""
def __init__(self, account: IcloudAccount, device: IcloudDevice):
def __init__(self, account: IcloudAccount, device: IcloudDevice) -> None:
"""Initialize the battery sensor."""
self._account = account
self._device = device

View File

@ -159,7 +159,7 @@ class ImageServeView(HomeAssistantView):
def __init__(
self, image_folder: pathlib.Path, image_collection: ImageStorageCollection
):
) -> None:
"""Initialize image serve view."""
self.transform_lock = asyncio.Lock()
self.image_folder = image_folder

View File

@ -144,7 +144,7 @@ async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
class InputBoolean(ToggleEntity, RestoreEntity):
"""Representation of a boolean input."""
def __init__(self, config: dict | None):
def __init__(self, config: dict | None) -> None:
"""Initialize a boolean input."""
self._config = config
self.editable = True

View File

@ -196,7 +196,7 @@ class NumberStorageCollection(collection.StorageCollection):
class InputNumber(RestoreEntity):
"""Representation of a slider."""
def __init__(self, config: dict):
def __init__(self, config: dict) -> None:
"""Initialize an input number."""
self._config = config
self.editable = True

View File

@ -201,7 +201,7 @@ class InputSelectStorageCollection(collection.StorageCollection):
class InputSelect(RestoreEntity):
"""Representation of a select input."""
def __init__(self, config: dict):
def __init__(self, config: dict) -> None:
"""Initialize a select input."""
self._config = config
self.editable = True

View File

@ -190,7 +190,7 @@ class InputTextStorageCollection(collection.StorageCollection):
class InputText(RestoreEntity):
"""Represent a text box."""
def __init__(self, config: dict):
def __init__(self, config: dict) -> None:
"""Initialize a text input."""
self._config = config
self.editable = True

View File

@ -82,7 +82,7 @@ class IPPDataUpdateCoordinator(DataUpdateCoordinator[IPPPrinter]):
base_path: str,
tls: bool,
verify_ssl: bool,
):
) -> None:
"""Initialize global IPP data updater."""
self.ipp = IPP(
host=host,

View File

@ -108,7 +108,7 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
VERSION = 1
def __init__(self):
def __init__(self) -> None:
"""Initialize the isy994 config flow."""
self.discovered_conf = {}
@ -194,7 +194,7 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
class OptionsFlowHandler(config_entries.OptionsFlow):
"""Handle a option flow for isy994."""
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

@ -27,7 +27,7 @@ async def async_setup_entry(
class RouterOnlineBinarySensor(BinarySensorEntity):
"""Representation router connection status."""
def __init__(self, router: KeeneticRouter):
def __init__(self, router: KeeneticRouter) -> None:
"""Initialize the APCUPSd binary device."""
self._router = router

View File

@ -89,7 +89,7 @@ class KeeneticFlowHandler(config_entries.ConfigFlow, domain=DOMAIN):
class KeeneticOptionsFlowHandler(config_entries.OptionsFlow):
"""Handle options."""
def __init__(self, config_entry: ConfigEntry):
def __init__(self, config_entry: ConfigEntry) -> None:
"""Initialize options flow."""
self.config_entry = config_entry
self._interface_options = {}

View File

@ -155,7 +155,7 @@ def update_items(router: KeeneticRouter, async_add_entities, tracked: set[str]):
class KeeneticTracker(ScannerEntity):
"""Representation of network device."""
def __init__(self, device: Device, router: KeeneticRouter):
def __init__(self, device: Device, router: KeeneticRouter) -> None:
"""Initialize the tracked device."""
self._device = device
self._router = router

View File

@ -37,7 +37,7 @@ _LOGGER = logging.getLogger(__name__)
class KeeneticRouter:
"""Keenetic client Object."""
def __init__(self, hass: HomeAssistant, config_entry: ConfigEntry):
def __init__(self, hass: HomeAssistant, config_entry: ConfigEntry) -> None:
"""Initialize the Client."""
self.hass = hass
self.config_entry = config_entry

View File

@ -86,7 +86,7 @@ def _async_migrate_unique_id(
class KNXCover(KnxEntity, CoverEntity):
"""Representation of a KNX cover."""
def __init__(self, xknx: XKNX, config: ConfigType):
def __init__(self, xknx: XKNX, config: ConfigType) -> None:
"""Initialize the cover."""
self._device: XknxCover
super().__init__(

View File

@ -168,7 +168,7 @@ class KonnectedFlowHandler(config_entries.ConfigFlow, domain=DOMAIN):
# class variable to store/share discovered host information
discovered_hosts = {}
def __init__(self):
def __init__(self) -> None:
"""Initialize the Konnected flow."""
self.data = {}
self.options = OPTIONS_SCHEMA({CONF_IO: {}})
@ -360,7 +360,7 @@ class KonnectedFlowHandler(config_entries.ConfigFlow, domain=DOMAIN):
class OptionsFlowHandler(config_entries.OptionsFlow):
"""Handle a option flow for a Konnected Panel."""
def __init__(self, config_entry: config_entries.ConfigEntry):
def __init__(self, config_entry: config_entries.ConfigEntry) -> None:
"""Initialize options flow."""
self.entry = config_entry
self.model = self.entry.data[CONF_MODEL]

View File

@ -121,7 +121,7 @@ class PlenticoreUpdateCoordinator(DataUpdateCoordinator):
name: str,
update_inverval: timedelta,
plenticore: Plenticore,
):
) -> None:
"""Create a new update coordinator for plenticore data."""
super().__init__(
hass=hass,

View File

@ -68,7 +68,7 @@ async def async_setup_entry(
class KulerskyLight(LightEntity):
"""Representation of an Kuler Sky Light."""
def __init__(self, light: pykulersky.Light):
def __init__(self, light: pykulersky.Light) -> None:
"""Initialize a Kuler Sky light."""
self._light = light
self._hs_color = None