Add constructor return type in integrations L-N (#50888)

* Add constructor return type in integrations L-N

* Small fix
This commit is contained in:
Maciej Bieniek 2021-05-20 14:06:44 +02:00 committed by GitHub
parent f3db819548
commit e06a2a53c4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
41 changed files with 44 additions and 44 deletions

View file

@ -488,7 +488,7 @@ class Profile:
class Profiles: class Profiles:
"""Representation of available color profiles.""" """Representation of available color profiles."""
def __init__(self, hass: HomeAssistant): def __init__(self, hass: HomeAssistant) -> None:
"""Initialize profiles.""" """Initialize profiles."""
self.hass = hass self.hass = hass
self.data: dict[str, Profile] = {} self.data: dict[str, Profile] = {}

View file

@ -52,7 +52,7 @@ class ResourceStorageCollection(collection.StorageCollection):
CREATE_SCHEMA = vol.Schema(RESOURCE_CREATE_FIELDS) CREATE_SCHEMA = vol.Schema(RESOURCE_CREATE_FIELDS)
UPDATE_SCHEMA = vol.Schema(RESOURCE_UPDATE_FIELDS) UPDATE_SCHEMA = vol.Schema(RESOURCE_UPDATE_FIELDS)
def __init__(self, hass: HomeAssistant, ll_config: LovelaceConfig): def __init__(self, hass: HomeAssistant, ll_config: LovelaceConfig) -> None:
"""Initialize the storage collection.""" """Initialize the storage collection."""
super().__init__( super().__init__(
storage.Store(hass, RESOURCES_STORAGE_VERSION, RESOURCE_STORAGE_KEY), storage.Store(hass, RESOURCES_STORAGE_VERSION, RESOURCE_STORAGE_KEY),

View file

@ -18,7 +18,7 @@ class ConfigEntryLyricClient(LyricClient):
self, self,
websession: ClientSession, websession: ClientSession,
oauth_session: config_entry_oauth2_flow.OAuth2Session, oauth_session: config_entry_oauth2_flow.OAuth2Session,
): ) -> None:
"""Initialize Honeywell Lyric auth.""" """Initialize Honeywell Lyric auth."""
super().__init__(websession) super().__init__(websession)
self._oauth_session = oauth_session self._oauth_session = oauth_session

View file

@ -1161,7 +1161,7 @@ class BrowseMedia:
children: list[BrowseMedia] | None = None, children: list[BrowseMedia] | None = None,
children_media_class: str | None = None, children_media_class: str | None = None,
thumbnail: str | None = None, thumbnail: str | None = None,
): ) -> None:
"""Initialize browse media item.""" """Initialize browse media item."""
self.media_class = media_class self.media_class = media_class
self.media_content_id = media_content_id self.media_content_id = media_content_id

View file

@ -30,7 +30,7 @@ class LocalSource(MediaSource):
name: str = "Local Media" name: str = "Local Media"
def __init__(self, hass: HomeAssistant): def __init__(self, hass: HomeAssistant) -> None:
"""Initialize local source.""" """Initialize local source."""
super().__init__(DOMAIN) super().__init__(DOMAIN)
self.hass = hass self.hass = hass
@ -183,7 +183,7 @@ class LocalMediaView(HomeAssistantView):
url = "/media/{source_dir_id}/{location:.*}" url = "/media/{source_dir_id}/{location:.*}"
name = "media" name = "media"
def __init__(self, hass: HomeAssistant, source: LocalSource): def __init__(self, hass: HomeAssistant, source: LocalSource) -> None:
"""Initialize the media view.""" """Initialize the media view."""
self.hass = hass self.hass = hass
self.source = source self.source = source

View file

@ -29,7 +29,7 @@ class BrowseMediaSource(BrowseMedia):
children: list[BrowseMediaSource] | None children: list[BrowseMediaSource] | None
def __init__(self, *, domain: str | None, identifier: str | None, **kwargs): def __init__(self, *, domain: str | None, identifier: str | None, **kwargs) -> None:
"""Initialize media source browse media.""" """Initialize media source browse media."""
media_content_id = f"{URI_SCHEME}{domain or ''}" media_content_id = f"{URI_SCHEME}{domain or ''}"
if identifier: if identifier:
@ -106,7 +106,7 @@ class MediaSource(ABC):
name: str = None name: str = None
def __init__(self, domain: str): def __init__(self, domain: str) -> None:
"""Initialize a media source.""" """Initialize a media source."""
self.domain = domain self.domain = domain
if not self.name: if not self.name:

View file

@ -84,7 +84,7 @@ async def async_unload_entry(hass, config_entry):
class MelCloudDevice: class MelCloudDevice:
"""MELCloud Device instance.""" """MELCloud Device instance."""
def __init__(self, device: Device): def __init__(self, device: Device) -> None:
"""Construct a device wrapper.""" """Construct a device wrapper."""
self.device = device self.device = device
self.name = device.name self.name = device.name

View file

@ -100,7 +100,7 @@ async def async_setup_entry(
class MelCloudClimate(ClimateEntity): class MelCloudClimate(ClimateEntity):
"""Base climate device.""" """Base climate device."""
def __init__(self, device: MelCloudDevice): def __init__(self, device: MelCloudDevice) -> None:
"""Initialize the climate.""" """Initialize the climate."""
self.api = device self.api = device
self._base_device = self.api.device self._base_device = self.api.device

View file

@ -113,7 +113,7 @@ class MeteoFranceFlowHandler(config_entries.ConfigFlow, domain=DOMAIN):
class MeteoFranceOptionsFlowHandler(config_entries.OptionsFlow): class MeteoFranceOptionsFlowHandler(config_entries.OptionsFlow):
"""Handle a option flow.""" """Handle a option flow."""
def __init__(self, config_entry: config_entries.ConfigEntry): def __init__(self, config_entry: config_entries.ConfigEntry) -> None:
"""Initialize options flow.""" """Initialize options flow."""
self.config_entry = config_entry self.config_entry = config_entry

View file

@ -78,7 +78,7 @@ async def async_setup_entry(
class MeteoFranceSensor(CoordinatorEntity, SensorEntity): class MeteoFranceSensor(CoordinatorEntity, SensorEntity):
"""Representation of a Meteo-France sensor.""" """Representation of a Meteo-France sensor."""
def __init__(self, sensor_type: str, coordinator: DataUpdateCoordinator): def __init__(self, sensor_type: str, coordinator: DataUpdateCoordinator) -> None:
"""Initialize the Meteo-France sensor.""" """Initialize the Meteo-France sensor."""
super().__init__(coordinator) super().__init__(coordinator)
self._type = sensor_type self._type = sensor_type
@ -194,7 +194,7 @@ class MeteoFranceRainSensor(MeteoFranceSensor):
class MeteoFranceAlertSensor(MeteoFranceSensor): class MeteoFranceAlertSensor(MeteoFranceSensor):
"""Representation of a Meteo-France alert sensor.""" """Representation of a Meteo-France alert sensor."""
def __init__(self, sensor_type: str, coordinator: DataUpdateCoordinator): def __init__(self, sensor_type: str, coordinator: DataUpdateCoordinator) -> None:
"""Initialize the Meteo-France sensor.""" """Initialize the Meteo-France sensor."""
super().__init__(sensor_type, coordinator) super().__init__(sensor_type, coordinator)
dept_code = self.coordinator.data.domain_id dept_code = self.coordinator.data.domain_id

View file

@ -68,7 +68,7 @@ async def async_setup_entry(
class MeteoFranceWeather(CoordinatorEntity, WeatherEntity): class MeteoFranceWeather(CoordinatorEntity, WeatherEntity):
"""Representation of a weather condition.""" """Representation of a weather condition."""
def __init__(self, coordinator: DataUpdateCoordinator, mode: str): def __init__(self, coordinator: DataUpdateCoordinator, mode: str) -> None:
"""Initialise the platform with a data instance and station name.""" """Initialise the platform with a data instance and station name."""
super().__init__(coordinator) super().__init__(coordinator)
self._city_name = self.coordinator.data.position["name"] self._city_name = self.coordinator.data.position["name"]

View file

@ -232,7 +232,7 @@ class MinioListener:
prefix: str, prefix: str,
suffix: str, suffix: str,
events: list[str], events: list[str],
): ) -> None:
"""Create Listener.""" """Create Listener."""
self._queue = queue self._queue = queue
self._endpoint = endpoint self._endpoint = endpoint

View file

@ -89,7 +89,7 @@ class MinioEventThread(threading.Thread):
prefix: str, prefix: str,
suffix: str, suffix: str,
events: list[str], events: list[str],
): ) -> None:
"""Copy over all Minio client options.""" """Copy over all Minio client options."""
super().__init__() super().__init__()
self._queue = queue self._queue = queue

View file

@ -26,7 +26,7 @@ def unique_id(webhook_id, sensor_unique_id):
class MobileAppEntity(RestoreEntity): class MobileAppEntity(RestoreEntity):
"""Representation of an mobile app entity.""" """Representation of an mobile app entity."""
def __init__(self, config: dict, device: DeviceEntry, entry: ConfigEntry): def __init__(self, config: dict, device: DeviceEntry, entry: ConfigEntry) -> None:
"""Initialize the entity.""" """Initialize the entity."""
self._config = config self._config = config
self._device = device self._device = device

View file

@ -106,7 +106,7 @@ class ModbusThermostat(ClimateEntity):
self, self,
hub: ModbusHub, hub: ModbusHub,
config: dict[str, Any], config: dict[str, Any],
): ) -> None:
"""Initialize the modbus thermostat.""" """Initialize the modbus thermostat."""
self._hub: ModbusHub = hub self._hub: ModbusHub = hub
self._name = config[CONF_NAME] self._name = config[CONF_NAME]

View file

@ -74,7 +74,7 @@ class ModbusCover(CoverEntity, RestoreEntity):
self, self,
hub: ModbusHub, hub: ModbusHub,
config: dict[str, Any], config: dict[str, Any],
): ) -> None:
"""Initialize the modbus cover.""" """Initialize the modbus cover."""
self._hub: ModbusHub = hub self._hub: ModbusHub = hub
self._coil = config.get(CALL_TYPE_COIL) self._coil = config.get(CALL_TYPE_COIL)

View file

@ -52,7 +52,7 @@ async def async_setup_platform(
class ModbusSwitch(SwitchEntity, RestoreEntity): class ModbusSwitch(SwitchEntity, RestoreEntity):
"""Base class representing a Modbus switch.""" """Base class representing a Modbus switch."""
def __init__(self, hub: ModbusHub, config: dict): def __init__(self, hub: ModbusHub, config: dict) -> None:
"""Initialize the switch.""" """Initialize the switch."""
self._hub: ModbusHub = hub self._hub: ModbusHub = hub
self._name = config[CONF_NAME] self._name = config[CONF_NAME]

View file

@ -43,7 +43,7 @@ class MySensorsDevice:
node_id: int, node_id: int,
child_id: int, child_id: int,
value_type: int, value_type: int,
): ) -> None:
"""Set up the MySensors device.""" """Set up the MySensors device."""
self.gateway_id: GatewayId = gateway_id self.gateway_id: GatewayId = gateway_id
self.gateway: BaseAsyncGateway = gateway self.gateway: BaseAsyncGateway = gateway

View file

@ -108,7 +108,7 @@ async def async_unload_entry(hass: HomeAssistant, entry: ConfigType) -> bool:
class NeatoHub: class NeatoHub:
"""A My Neato hub wrapper class.""" """A My Neato hub wrapper class."""
def __init__(self, hass: HomeAssistant, neato: Account): def __init__(self, hass: HomeAssistant, neato: Account) -> None:
"""Initialize the Neato hub.""" """Initialize the Neato hub."""
self._hass = hass self._hass = hass
self.my_neato: Account = neato self.my_neato: Account = neato

View file

@ -15,7 +15,7 @@ class ConfigEntryAuth(pybotvac.OAuthSession):
hass: core.HomeAssistant, hass: core.HomeAssistant,
config_entry: config_entries.ConfigEntry, config_entry: config_entries.ConfigEntry,
implementation: config_entry_oauth2_flow.AbstractOAuth2Implementation, implementation: config_entry_oauth2_flow.AbstractOAuth2Implementation,
): ) -> None:
"""Initialize Neato Botvac Auth.""" """Initialize Neato Botvac Auth."""
self.hass = hass self.hass = hass
self.session = config_entry_oauth2_flow.OAuth2Session( self.session = config_entry_oauth2_flow.OAuth2Session(

View file

@ -106,7 +106,7 @@ async def async_setup(hass: HomeAssistant, config: dict):
class SignalUpdateCallback: class SignalUpdateCallback:
"""An EventCallback invoked when new events arrive from subscriber.""" """An EventCallback invoked when new events arrive from subscriber."""
def __init__(self, hass: HomeAssistant): def __init__(self, hass: HomeAssistant) -> None:
"""Initialize EventCallback.""" """Initialize EventCallback."""
self._hass = hass self._hass = hass

View file

@ -22,7 +22,7 @@ class AsyncConfigEntryAuth(AbstractAuth):
oauth_session: config_entry_oauth2_flow.OAuth2Session, oauth_session: config_entry_oauth2_flow.OAuth2Session,
client_id: str, client_id: str,
client_secret: str, client_secret: str,
): ) -> None:
"""Initialize Google Nest Device Access auth.""" """Initialize Google Nest Device Access auth."""
super().__init__(websession, API_URL) super().__init__(websession, API_URL)
self._oauth_session = oauth_session self._oauth_session = oauth_session

View file

@ -56,7 +56,7 @@ async def async_setup_sdm_entry(
class NestCamera(Camera): class NestCamera(Camera):
"""Devices that support cameras.""" """Devices that support cameras."""
def __init__(self, device: Device): def __init__(self, device: Device) -> None:
"""Initialize the camera.""" """Initialize the camera."""
super().__init__() super().__init__()
self._device = device self._device = device

View file

@ -98,7 +98,7 @@ async def async_setup_sdm_entry(
class ThermostatEntity(ClimateEntity): class ThermostatEntity(ClimateEntity):
"""A nest thermostat climate entity.""" """A nest thermostat climate entity."""
def __init__(self, device: Device): def __init__(self, device: Device) -> None:
"""Initialize ThermostatEntity.""" """Initialize ThermostatEntity."""
self._device = device self._device = device
self._device_info = DeviceInfo(device) self._device_info = DeviceInfo(device)

View file

@ -18,7 +18,7 @@ class DeviceInfo:
device_brand = "Google Nest" device_brand = "Google Nest"
def __init__(self, device: Device): def __init__(self, device: Device) -> None:
"""Initialize the DeviceInfo.""" """Initialize the DeviceInfo."""
self._device = device self._device = device

View file

@ -56,7 +56,7 @@ async def async_setup_sdm_entry(
class SensorBase(SensorEntity): class SensorBase(SensorEntity):
"""Representation of a dynamically updated Sensor.""" """Representation of a dynamically updated Sensor."""
def __init__(self, device: Device): def __init__(self, device: Device) -> None:
"""Initialize the sensor.""" """Initialize the sensor."""
self._device = device self._device = device
self._device_info = DeviceInfo(device) self._device_info = DeviceInfo(device)

View file

@ -15,7 +15,7 @@ class ConfigEntryNetatmoAuth(pyatmo.auth.NetatmoOAuth2):
hass: core.HomeAssistant, hass: core.HomeAssistant,
config_entry: config_entries.ConfigEntry, config_entry: config_entries.ConfigEntry,
implementation: config_entry_oauth2_flow.AbstractOAuth2Implementation, implementation: config_entry_oauth2_flow.AbstractOAuth2Implementation,
): ) -> None:
"""Initialize Netatmo Auth.""" """Initialize Netatmo Auth."""
self.hass = hass self.hass = hass
self.session = config_entry_oauth2_flow.OAuth2Session( self.session = config_entry_oauth2_flow.OAuth2Session(

View file

@ -75,7 +75,7 @@ class NetatmoFlowHandler(
class NetatmoOptionsFlowHandler(config_entries.OptionsFlow): class NetatmoOptionsFlowHandler(config_entries.OptionsFlow):
"""Handle Netatmo options.""" """Handle Netatmo options."""
def __init__(self, config_entry: config_entries.ConfigEntry): def __init__(self, config_entry: config_entries.ConfigEntry) -> None:
"""Initialize Netatmo options flow.""" """Initialize Netatmo options flow."""
self.config_entry = config_entry self.config_entry = config_entry
self.options = dict(config_entry.options) self.options = dict(config_entry.options)

View file

@ -52,7 +52,7 @@ SCAN_INTERVAL = 60
class NetatmoDataHandler: class NetatmoDataHandler:
"""Manages the Netatmo data handling.""" """Manages the Netatmo data handling."""
def __init__(self, hass: HomeAssistant, entry: ConfigEntry): def __init__(self, hass: HomeAssistant, entry: ConfigEntry) -> None:
"""Initialize self.""" """Initialize self."""
self.hass = hass self.hass = hass
self._auth = hass.data[DOMAIN][entry.entry_id][AUTH] self._auth = hass.data[DOMAIN][entry.entry_id][AUTH]

View file

@ -80,7 +80,7 @@ class NetatmoLight(NetatmoBase, LightEntity):
camera_id: str, camera_id: str,
camera_type: str, camera_type: str,
home_id: str, home_id: str,
): ) -> None:
"""Initialize a Netatmo Presence camera light.""" """Initialize a Netatmo Presence camera light."""
LightEntity.__init__(self) LightEntity.__init__(self)
super().__init__(data_handler) super().__init__(data_handler)

View file

@ -41,7 +41,7 @@ class NetatmoSource(MediaSource):
name: str = MANUFACTURER name: str = MANUFACTURER
def __init__(self, hass: HomeAssistant): def __init__(self, hass: HomeAssistant) -> None:
"""Initialize Netatmo source.""" """Initialize Netatmo source."""
super().__init__(DOMAIN) super().__init__(DOMAIN)
self.hass = hass self.hass = hass

View file

@ -66,7 +66,7 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
class InputValidationError(exceptions.HomeAssistantError): class InputValidationError(exceptions.HomeAssistantError):
"""Error to indicate we cannot proceed due to invalid input.""" """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.""" """Initialize with error base."""
super().__init__() super().__init__()
self.base = base self.base = base

View file

@ -158,7 +158,7 @@ class NiluData:
class NiluSensor(AirQualityEntity): class NiluSensor(AirQualityEntity):
"""Single nilu station air sensor.""" """Single nilu station air sensor."""
def __init__(self, api_data: NiluData, name: str, show_on_map: bool): def __init__(self, api_data: NiluData, name: str, show_on_map: bool) -> None:
"""Initialize the sensor.""" """Initialize the sensor."""
self._api = api_data self._api = api_data
self._name = f"{name} {api_data.data.name}" self._name = f"{name} {api_data.data.name}"

View file

@ -141,7 +141,7 @@ class NotionEntity(CoordinatorEntity):
system_id: str, system_id: str,
name: str, name: str,
device_class: str, device_class: str,
): ) -> None:
"""Initialize the entity.""" """Initialize the entity."""
super().__init__(coordinator) super().__init__(coordinator)
self._attrs = {ATTR_ATTRIBUTION: DEFAULT_ATTRIBUTION} self._attrs = {ATTR_ATTRIBUTION: DEFAULT_ATTRIBUTION}

View file

@ -55,7 +55,7 @@ class NotionSensor(NotionEntity, SensorEntity):
name: str, name: str,
device_class: str, device_class: str,
unit: str, unit: str,
): ) -> None:
"""Initialize the entity.""" """Initialize the entity."""
super().__init__( super().__init__(
coordinator, task_id, sensor_id, bridge_id, system_id, name, device_class coordinator, task_id, sensor_id, bridge_id, system_id, name, device_class

View file

@ -148,7 +148,7 @@ class StationPriceData:
class StationPriceSensor(SensorEntity): class StationPriceSensor(SensorEntity):
"""Implementation of a sensor that reports the fuel price for a station.""" """Implementation of a sensor that reports the fuel price for a station."""
def __init__(self, station_data: StationPriceData, fuel_type: str): def __init__(self, station_data: StationPriceData, fuel_type: str) -> None:
"""Initialize the sensor.""" """Initialize the sensor."""
self._station_data = station_data self._station_data = station_data
self._fuel_type = fuel_type self._fuel_type = fuel_type

View file

@ -227,7 +227,7 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
class OptionsFlowHandler(config_entries.OptionsFlow): class OptionsFlowHandler(config_entries.OptionsFlow):
"""Handle a option flow for nut.""" """Handle a option flow for nut."""
def __init__(self, config_entry: config_entries.ConfigEntry): def __init__(self, config_entry: config_entries.ConfigEntry) -> None:
"""Initialize options flow.""" """Initialize options flow."""
self.config_entry = config_entry self.config_entry = config_entry

View file

@ -57,7 +57,7 @@ class NwsDataUpdateCoordinator(DataUpdateCoordinator):
failed_update_interval: datetime.timedelta, failed_update_interval: datetime.timedelta,
update_method: Callable[[], Awaitable] | None = None, update_method: Callable[[], Awaitable] | None = None,
request_refresh_debouncer: debounce.Debouncer | None = None, request_refresh_debouncer: debounce.Debouncer | None = None,
): ) -> None:
"""Initialize NWS coordinator.""" """Initialize NWS coordinator."""
super().__init__( super().__init__(
hass, hass,

View file

@ -25,7 +25,7 @@ _LOGGER = logging.getLogger(__name__)
class NZBGetDataUpdateCoordinator(DataUpdateCoordinator): class NZBGetDataUpdateCoordinator(DataUpdateCoordinator):
"""Class to manage fetching NZBGet data.""" """Class to manage fetching NZBGet data."""
def __init__(self, hass: HomeAssistant, *, config: dict, options: dict): def __init__(self, hass: HomeAssistant, *, config: dict, options: dict) -> None:
"""Initialize global NZBGet data updater.""" """Initialize global NZBGet data updater."""
self.nzbget = NZBGetAPI( self.nzbget = NZBGetAPI(
config[CONF_HOST], config[CONF_HOST],

View file

@ -77,7 +77,7 @@ class NZBGetSensor(NZBGetEntity, SensorEntity):
sensor_type: str, sensor_type: str,
sensor_name: str, sensor_name: str,
unit_of_measurement: str | None = None, unit_of_measurement: str | None = None,
): ) -> None:
"""Initialize a new NZBGet sensor.""" """Initialize a new NZBGet sensor."""
self._sensor_type = sensor_type self._sensor_type = sensor_type
self._unique_id = f"{entry_id}_{sensor_type}" self._unique_id = f"{entry_id}_{sensor_type}"

View file

@ -41,7 +41,7 @@ class NZBGetDownloadSwitch(NZBGetEntity, SwitchEntity):
coordinator: NZBGetDataUpdateCoordinator, coordinator: NZBGetDataUpdateCoordinator,
entry_id: str, entry_id: str,
entry_name: str, entry_name: str,
): ) -> None:
"""Initialize a new NZBGet switch.""" """Initialize a new NZBGet switch."""
self._unique_id = f"{entry_id}_download" self._unique_id = f"{entry_id}_download"