From 69bc6bbe489b175bec6441ccc831d6522b77bd67 Mon Sep 17 00:00:00 2001 From: jan iversen Date: Tue, 17 Aug 2021 10:10:56 +0200 Subject: [PATCH] Activate mypy for google_pubsub (#54649) --- .coveragerc | 1 + homeassistant/components/google_pubsub/__init__.py | 9 ++++++--- mypy.ini | 3 --- script/hassfest/mypy_config.py | 1 - 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.coveragerc b/.coveragerc index 4b5c0820650..e25f664efe8 100644 --- a/.coveragerc +++ b/.coveragerc @@ -375,6 +375,7 @@ omit = homeassistant/components/google/* homeassistant/components/google_cloud/tts.py homeassistant/components/google_maps/device_tracker.py + homeassistant/components/google_pubsub/__init__.py homeassistant/components/google_travel_time/__init__.py homeassistant/components/google_travel_time/helpers.py homeassistant/components/google_travel_time/sensor.py diff --git a/homeassistant/components/google_pubsub/__init__.py b/homeassistant/components/google_pubsub/__init__.py index 514b919e877..19530d9d663 100644 --- a/homeassistant/components/google_pubsub/__init__.py +++ b/homeassistant/components/google_pubsub/__init__.py @@ -45,9 +45,12 @@ def setup(hass: HomeAssistant, yaml_config: dict[str, Any]): config = yaml_config[DOMAIN] project_id = config[CONF_PROJECT_ID] topic_name = config[CONF_TOPIC_NAME] - service_principal_path = os.path.join( - hass.config.config_dir, config[CONF_SERVICE_PRINCIPAL] - ) + if hass.config.config_dir: + service_principal_path = os.path.join( + hass.config.config_dir, config[CONF_SERVICE_PRINCIPAL] + ) + else: + service_principal_path = config[CONF_SERVICE_PRINCIPAL] if not os.path.isfile(service_principal_path): _LOGGER.error("Path to credentials file cannot be found") diff --git a/mypy.ini b/mypy.ini index 837dc73343a..3108f73a49e 100644 --- a/mypy.ini +++ b/mypy.ini @@ -1367,9 +1367,6 @@ ignore_errors = true [mypy-homeassistant.components.google_assistant.*] ignore_errors = true -[mypy-homeassistant.components.google_pubsub.*] -ignore_errors = true - [mypy-homeassistant.components.gpmdp.*] ignore_errors = true diff --git a/script/hassfest/mypy_config.py b/script/hassfest/mypy_config.py index 513be3e59c2..6a863355afc 100644 --- a/script/hassfest/mypy_config.py +++ b/script/hassfest/mypy_config.py @@ -48,7 +48,6 @@ IGNORED_MODULES: Final[list[str]] = [ "homeassistant.components.geniushub.*", "homeassistant.components.glances.*", "homeassistant.components.google_assistant.*", - "homeassistant.components.google_pubsub.*", "homeassistant.components.gpmdp.*", "homeassistant.components.gree.*", "homeassistant.components.growatt_server.*",