From cf7c716bda484a497573c65963f696be8c294f69 Mon Sep 17 00:00:00 2001 From: Marc Mueller <30130371+cdce8p@users.noreply.github.com> Date: Sat, 13 Aug 2022 18:46:08 +0200 Subject: [PATCH] Fix implicit Optional [core] (#76719) --- .../components/application_credentials/__init__.py | 2 +- homeassistant/components/mobile_app/helpers.py | 6 +++--- homeassistant/components/mqtt/mixins.py | 2 +- homeassistant/components/template/template_entity.py | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/homeassistant/components/application_credentials/__init__.py b/homeassistant/components/application_credentials/__init__.py index 14ae049cfcae..6dd2d5623078 100644 --- a/homeassistant/components/application_credentials/__init__.py +++ b/homeassistant/components/application_credentials/__init__.py @@ -168,7 +168,7 @@ async def async_import_client_credential( hass: HomeAssistant, domain: str, credential: ClientCredential, - auth_domain: str = None, + auth_domain: str | None = None, ) -> None: """Import an existing credential from configuration.yaml.""" if DOMAIN not in hass.data: diff --git a/homeassistant/components/mobile_app/helpers.py b/homeassistant/components/mobile_app/helpers.py index e1c0841984fc..a116e6196f42 100644 --- a/homeassistant/components/mobile_app/helpers.py +++ b/homeassistant/components/mobile_app/helpers.py @@ -117,7 +117,7 @@ def registration_context(registration: dict) -> Context: def empty_okay_response( - headers: dict = None, status: HTTPStatus = HTTPStatus.OK + headers: dict | None = None, status: HTTPStatus = HTTPStatus.OK ) -> Response: """Return a Response with empty JSON object and a 200.""" return Response( @@ -129,7 +129,7 @@ def error_response( code: str, message: str, status: HTTPStatus = HTTPStatus.BAD_REQUEST, - headers: dict = None, + headers: dict | None = None, ) -> Response: """Return an error Response.""" return json_response( @@ -177,7 +177,7 @@ def webhook_response( *, registration: dict, status: HTTPStatus = HTTPStatus.OK, - headers: dict = None, + headers: dict | None = None, ) -> Response: """Return a encrypted response if registration supports it.""" data = json.dumps(data, cls=JSONEncoder) diff --git a/homeassistant/components/mqtt/mixins.py b/homeassistant/components/mqtt/mixins.py index f0cc0c4ad447..4b7ae92c6f4e 100644 --- a/homeassistant/components/mqtt/mixins.py +++ b/homeassistant/components/mqtt/mixins.py @@ -287,7 +287,7 @@ async def async_discover_yaml_entities( async def async_get_platform_config_from_yaml( hass: HomeAssistant, platform_domain: str, - config_yaml: ConfigType = None, + config_yaml: ConfigType | None = None, ) -> list[ConfigType]: """Return a list of validated configurations for the domain.""" diff --git a/homeassistant/components/template/template_entity.py b/homeassistant/components/template/template_entity.py index 901834237c64..87c8ec651d23 100644 --- a/homeassistant/components/template/template_entity.py +++ b/homeassistant/components/template/template_entity.py @@ -79,7 +79,7 @@ LEGACY_FIELDS = { 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]: """Rewrite legacy config.""" entity_cfg = {**entity_cfg}