mirror of
https://github.com/home-assistant/core
synced 2024-08-02 23:40:32 +02:00
Fix implicit Optional [core] (#76719)
This commit is contained in:
parent
a70252a243
commit
cf7c716bda
@ -168,7 +168,7 @@ async def async_import_client_credential(
|
|||||||
hass: HomeAssistant,
|
hass: HomeAssistant,
|
||||||
domain: str,
|
domain: str,
|
||||||
credential: ClientCredential,
|
credential: ClientCredential,
|
||||||
auth_domain: str = None,
|
auth_domain: str | None = None,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Import an existing credential from configuration.yaml."""
|
"""Import an existing credential from configuration.yaml."""
|
||||||
if DOMAIN not in hass.data:
|
if DOMAIN not in hass.data:
|
||||||
|
@ -117,7 +117,7 @@ def registration_context(registration: dict) -> Context:
|
|||||||
|
|
||||||
|
|
||||||
def empty_okay_response(
|
def empty_okay_response(
|
||||||
headers: dict = None, status: HTTPStatus = HTTPStatus.OK
|
headers: dict | None = None, status: HTTPStatus = HTTPStatus.OK
|
||||||
) -> Response:
|
) -> Response:
|
||||||
"""Return a Response with empty JSON object and a 200."""
|
"""Return a Response with empty JSON object and a 200."""
|
||||||
return Response(
|
return Response(
|
||||||
@ -129,7 +129,7 @@ def error_response(
|
|||||||
code: str,
|
code: str,
|
||||||
message: str,
|
message: str,
|
||||||
status: HTTPStatus = HTTPStatus.BAD_REQUEST,
|
status: HTTPStatus = HTTPStatus.BAD_REQUEST,
|
||||||
headers: dict = None,
|
headers: dict | None = None,
|
||||||
) -> Response:
|
) -> Response:
|
||||||
"""Return an error Response."""
|
"""Return an error Response."""
|
||||||
return json_response(
|
return json_response(
|
||||||
@ -177,7 +177,7 @@ def webhook_response(
|
|||||||
*,
|
*,
|
||||||
registration: dict,
|
registration: dict,
|
||||||
status: HTTPStatus = HTTPStatus.OK,
|
status: HTTPStatus = HTTPStatus.OK,
|
||||||
headers: dict = None,
|
headers: dict | None = None,
|
||||||
) -> Response:
|
) -> Response:
|
||||||
"""Return a encrypted response if registration supports it."""
|
"""Return a encrypted response if registration supports it."""
|
||||||
data = json.dumps(data, cls=JSONEncoder)
|
data = json.dumps(data, cls=JSONEncoder)
|
||||||
|
@ -287,7 +287,7 @@ async def async_discover_yaml_entities(
|
|||||||
async def async_get_platform_config_from_yaml(
|
async def async_get_platform_config_from_yaml(
|
||||||
hass: HomeAssistant,
|
hass: HomeAssistant,
|
||||||
platform_domain: str,
|
platform_domain: str,
|
||||||
config_yaml: ConfigType = None,
|
config_yaml: ConfigType | None = None,
|
||||||
) -> list[ConfigType]:
|
) -> list[ConfigType]:
|
||||||
"""Return a list of validated configurations for the domain."""
|
"""Return a list of validated configurations for the domain."""
|
||||||
|
|
||||||
|
@ -79,7 +79,7 @@ LEGACY_FIELDS = {
|
|||||||
|
|
||||||
|
|
||||||
def rewrite_common_legacy_to_modern_conf(
|
def rewrite_common_legacy_to_modern_conf(
|
||||||
entity_cfg: dict[str, Any], extra_legacy_fields: dict[str, str] = None
|
entity_cfg: dict[str, Any], extra_legacy_fields: dict[str, str] | None = None
|
||||||
) -> dict[str, Any]:
|
) -> dict[str, Any]:
|
||||||
"""Rewrite legacy config."""
|
"""Rewrite legacy config."""
|
||||||
entity_cfg = {**entity_cfg}
|
entity_cfg = {**entity_cfg}
|
||||||
|
Loading…
Reference in New Issue
Block a user