Fix implicit Optional [a-n] (#76720)
This commit is contained in:
parent
cf7c716bda
commit
5a046ae7be
11 changed files with 21 additions and 16 deletions
|
@ -19,7 +19,9 @@ class ClimaCellOptionsConfigFlow(config_entries.OptionsFlow):
|
||||||
"""Initialize ClimaCell options flow."""
|
"""Initialize ClimaCell options flow."""
|
||||||
self._config_entry = config_entry
|
self._config_entry = config_entry
|
||||||
|
|
||||||
async def async_step_init(self, user_input: dict[str, Any] = None) -> FlowResult:
|
async def async_step_init(
|
||||||
|
self, user_input: dict[str, Any] | None = None
|
||||||
|
) -> FlowResult:
|
||||||
"""Manage the ClimaCell options."""
|
"""Manage the ClimaCell options."""
|
||||||
if user_input is not None:
|
if user_input is not None:
|
||||||
return self.async_create_entry(title="", data=user_input)
|
return self.async_create_entry(title="", data=user_input)
|
||||||
|
|
|
@ -100,7 +100,7 @@ class DirecTVConfigFlow(ConfigFlow, domain=DOMAIN):
|
||||||
return await self.async_step_ssdp_confirm()
|
return await self.async_step_ssdp_confirm()
|
||||||
|
|
||||||
async def async_step_ssdp_confirm(
|
async def async_step_ssdp_confirm(
|
||||||
self, user_input: dict[str, Any] = None
|
self, user_input: dict[str, Any] | None = None
|
||||||
) -> FlowResult:
|
) -> FlowResult:
|
||||||
"""Handle a confirmation flow initiated by SSDP."""
|
"""Handle a confirmation flow initiated by SSDP."""
|
||||||
if user_input is None:
|
if user_input is None:
|
||||||
|
|
|
@ -152,7 +152,7 @@ class ControllerEntity(ClimateEntity):
|
||||||
)
|
)
|
||||||
|
|
||||||
@callback
|
@callback
|
||||||
def set_available(self, available: bool, ex: Exception = None) -> None:
|
def set_available(self, available: bool, ex: Exception | None = None) -> None:
|
||||||
"""Set availability for the controller."""
|
"""Set availability for the controller."""
|
||||||
if self._attr_available == available:
|
if self._attr_available == available:
|
||||||
return
|
return
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
"""Mixin class for handling harmony callback subscriptions."""
|
"""Mixin class for handling harmony callback subscriptions."""
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
import asyncio
|
import asyncio
|
||||||
import logging
|
import logging
|
||||||
|
@ -85,7 +86,9 @@ class HarmonySubscriberMixin:
|
||||||
self.async_unlock_start_activity()
|
self.async_unlock_start_activity()
|
||||||
self._call_callbacks("activity_started", activity_info)
|
self._call_callbacks("activity_started", activity_info)
|
||||||
|
|
||||||
def _call_callbacks(self, callback_func_name: str, argument: tuple = None) -> None:
|
def _call_callbacks(
|
||||||
|
self, callback_func_name: str, argument: tuple | None = None
|
||||||
|
) -> None:
|
||||||
for subscription in self._subscriptions:
|
for subscription in self._subscriptions:
|
||||||
current_callback = getattr(subscription, callback_func_name)
|
current_callback = getattr(subscription, callback_func_name)
|
||||||
if current_callback:
|
if current_callback:
|
||||||
|
|
|
@ -42,7 +42,7 @@ class HuisbaasjeSensor(CoordinatorEntity, SensorEntity):
|
||||||
user_id: str,
|
user_id: str,
|
||||||
name: str,
|
name: str,
|
||||||
source_type: str,
|
source_type: str,
|
||||||
device_class: str = None,
|
device_class: str | None = None,
|
||||||
sensor_type: str = SENSOR_TYPE_RATE,
|
sensor_type: str = SENSOR_TYPE_RATE,
|
||||||
unit_of_measurement: str = POWER_WATT,
|
unit_of_measurement: str = POWER_WATT,
|
||||||
icon: str = "mdi:lightning-bolt",
|
icon: str = "mdi:lightning-bolt",
|
||||||
|
|
|
@ -174,7 +174,7 @@ class IPPFlowHandler(ConfigFlow, domain=DOMAIN):
|
||||||
return await self.async_step_zeroconf_confirm()
|
return await self.async_step_zeroconf_confirm()
|
||||||
|
|
||||||
async def async_step_zeroconf_confirm(
|
async def async_step_zeroconf_confirm(
|
||||||
self, user_input: dict[str, Any] = None
|
self, user_input: dict[str, Any] | None = None
|
||||||
) -> FlowResult:
|
) -> FlowResult:
|
||||||
"""Handle a confirmation flow initiated by zeroconf."""
|
"""Handle a confirmation flow initiated by zeroconf."""
|
||||||
if user_input is None:
|
if user_input is None:
|
||||||
|
|
|
@ -216,7 +216,7 @@ class ControllerDevice(ClimateEntity):
|
||||||
return self._available
|
return self._available
|
||||||
|
|
||||||
@callback
|
@callback
|
||||||
def set_available(self, available: bool, ex: Exception = None) -> None:
|
def set_available(self, available: bool, ex: Exception | None = None) -> None:
|
||||||
"""
|
"""
|
||||||
Set availability for the controller.
|
Set availability for the controller.
|
||||||
|
|
||||||
|
|
|
@ -150,7 +150,7 @@ class MinecraftServer:
|
||||||
)
|
)
|
||||||
self.online = False
|
self.online = False
|
||||||
|
|
||||||
async def async_update(self, now: datetime = None) -> None:
|
async def async_update(self, now: datetime | None = None) -> None:
|
||||||
"""Get server data from 3rd party library and update properties."""
|
"""Get server data from 3rd party library and update properties."""
|
||||||
# Check connection status.
|
# Check connection status.
|
||||||
server_online_old = self.online
|
server_online_old = self.online
|
||||||
|
|
|
@ -544,7 +544,7 @@ class MotionEyeEntity(CoordinatorEntity):
|
||||||
client: MotionEyeClient,
|
client: MotionEyeClient,
|
||||||
coordinator: DataUpdateCoordinator,
|
coordinator: DataUpdateCoordinator,
|
||||||
options: MappingProxyType[str, Any],
|
options: MappingProxyType[str, Any],
|
||||||
entity_description: EntityDescription = None,
|
entity_description: EntityDescription | None = None,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Initialize a motionEye entity."""
|
"""Initialize a motionEye entity."""
|
||||||
self._camera_id = camera[KEY_ID]
|
self._camera_id = camera[KEY_ID]
|
||||||
|
|
|
@ -266,10 +266,10 @@ class MotionEyeMjpegCamera(MotionEyeEntity, MjpegCamera):
|
||||||
|
|
||||||
async def async_set_text_overlay(
|
async def async_set_text_overlay(
|
||||||
self,
|
self,
|
||||||
left_text: str = None,
|
left_text: str | None = None,
|
||||||
right_text: str = None,
|
right_text: str | None = None,
|
||||||
custom_left_text: str = None,
|
custom_left_text: str | None = None,
|
||||||
custom_right_text: str = None,
|
custom_right_text: str | None = None,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Set text overlay for a camera."""
|
"""Set text overlay for a camera."""
|
||||||
# Fetch the very latest camera config to reduce the risk of updating with a
|
# Fetch the very latest camera config to reduce the risk of updating with a
|
||||||
|
|
|
@ -42,9 +42,9 @@ _LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
def get_api(
|
def get_api(
|
||||||
password: str,
|
password: str,
|
||||||
host: str = None,
|
host: str | None = None,
|
||||||
username: str = None,
|
username: str | None = None,
|
||||||
port: int = None,
|
port: int | None = None,
|
||||||
ssl: bool = False,
|
ssl: bool = False,
|
||||||
) -> Netgear:
|
) -> Netgear:
|
||||||
"""Get the Netgear API and login to it."""
|
"""Get the Netgear API and login to it."""
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue