Fix implicit Optional [a-n] (#76720)

This commit is contained in:
Marc Mueller 2022-08-13 18:46:34 +02:00 committed by GitHub
parent cf7c716bda
commit 5a046ae7be
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 21 additions and 16 deletions

View file

@ -19,7 +19,9 @@ class ClimaCellOptionsConfigFlow(config_entries.OptionsFlow):
"""Initialize ClimaCell options flow."""
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."""
if user_input is not None:
return self.async_create_entry(title="", data=user_input)

View file

@ -100,7 +100,7 @@ class DirecTVConfigFlow(ConfigFlow, domain=DOMAIN):
return await self.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:
"""Handle a confirmation flow initiated by SSDP."""
if user_input is None:

View file

@ -152,7 +152,7 @@ class ControllerEntity(ClimateEntity):
)
@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."""
if self._attr_available == available:
return

View file

@ -1,4 +1,5 @@
"""Mixin class for handling harmony callback subscriptions."""
from __future__ import annotations
import asyncio
import logging
@ -85,7 +86,9 @@ class HarmonySubscriberMixin:
self.async_unlock_start_activity()
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:
current_callback = getattr(subscription, callback_func_name)
if current_callback:

View file

@ -42,7 +42,7 @@ class HuisbaasjeSensor(CoordinatorEntity, SensorEntity):
user_id: str,
name: str,
source_type: str,
device_class: str = None,
device_class: str | None = None,
sensor_type: str = SENSOR_TYPE_RATE,
unit_of_measurement: str = POWER_WATT,
icon: str = "mdi:lightning-bolt",

View file

@ -174,7 +174,7 @@ class IPPFlowHandler(ConfigFlow, domain=DOMAIN):
return await self.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:
"""Handle a confirmation flow initiated by zeroconf."""
if user_input is None:

View file

@ -216,7 +216,7 @@ class ControllerDevice(ClimateEntity):
return self._available
@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.

View file

@ -150,7 +150,7 @@ class MinecraftServer:
)
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."""
# Check connection status.
server_online_old = self.online

View file

@ -544,7 +544,7 @@ class MotionEyeEntity(CoordinatorEntity):
client: MotionEyeClient,
coordinator: DataUpdateCoordinator,
options: MappingProxyType[str, Any],
entity_description: EntityDescription = None,
entity_description: EntityDescription | None = None,
) -> None:
"""Initialize a motionEye entity."""
self._camera_id = camera[KEY_ID]

View file

@ -266,10 +266,10 @@ class MotionEyeMjpegCamera(MotionEyeEntity, MjpegCamera):
async def async_set_text_overlay(
self,
left_text: str = None,
right_text: str = None,
custom_left_text: str = None,
custom_right_text: str = None,
left_text: str | None = None,
right_text: str | None = None,
custom_left_text: str | None = None,
custom_right_text: str | None = None,
) -> None:
"""Set text overlay for a camera."""
# Fetch the very latest camera config to reduce the risk of updating with a

View file

@ -42,9 +42,9 @@ _LOGGER = logging.getLogger(__name__)
def get_api(
password: str,
host: str = None,
username: str = None,
port: int = None,
host: str | None = None,
username: str | None = None,
port: int | None = None,
ssl: bool = False,
) -> Netgear:
"""Get the Netgear API and login to it."""