From 093f07c04e88e546ef24a055430d4e2772ada71b Mon Sep 17 00:00:00 2001 From: Marc Mueller <30130371+cdce8p@users.noreply.github.com> Date: Fri, 7 Jun 2024 11:13:33 +0200 Subject: [PATCH] Add type ignore comments (#119052) --- homeassistant/components/google_assistant_sdk/__init__.py | 2 +- homeassistant/components/google_assistant_sdk/helpers.py | 2 +- homeassistant/components/google_sheets/__init__.py | 4 +++- homeassistant/components/google_sheets/config_flow.py | 4 +++- homeassistant/components/nest/api.py | 4 ++-- 5 files changed, 10 insertions(+), 6 deletions(-) diff --git a/homeassistant/components/google_assistant_sdk/__init__.py b/homeassistant/components/google_assistant_sdk/__init__.py index 52950a82b93..b92b3c54579 100644 --- a/homeassistant/components/google_assistant_sdk/__init__.py +++ b/homeassistant/components/google_assistant_sdk/__init__.py @@ -165,7 +165,7 @@ class GoogleAssistantConversationAgent(conversation.AbstractConversationAgent): await session.async_ensure_token_valid() self.assistant = None if not self.assistant or user_input.language != self.language: - credentials = Credentials(session.token[CONF_ACCESS_TOKEN]) + credentials = Credentials(session.token[CONF_ACCESS_TOKEN]) # type: ignore[no-untyped-call] self.language = user_input.language self.assistant = TextAssistant(credentials, self.language) diff --git a/homeassistant/components/google_assistant_sdk/helpers.py b/homeassistant/components/google_assistant_sdk/helpers.py index b6b13f92fcf..24da381e8e0 100644 --- a/homeassistant/components/google_assistant_sdk/helpers.py +++ b/homeassistant/components/google_assistant_sdk/helpers.py @@ -72,7 +72,7 @@ async def async_send_text_commands( entry.async_start_reauth(hass) raise - credentials = Credentials(session.token[CONF_ACCESS_TOKEN]) + credentials = Credentials(session.token[CONF_ACCESS_TOKEN]) # type: ignore[no-untyped-call] language_code = entry.options.get(CONF_LANGUAGE_CODE, default_language_code(hass)) with TextAssistant( credentials, language_code, audio_out=bool(media_players) diff --git a/homeassistant/components/google_sheets/__init__.py b/homeassistant/components/google_sheets/__init__.py index f346f913e0c..713a801257d 100644 --- a/homeassistant/components/google_sheets/__init__.py +++ b/homeassistant/components/google_sheets/__init__.py @@ -93,7 +93,9 @@ async def async_setup_service(hass: HomeAssistant) -> None: def _append_to_sheet(call: ServiceCall, entry: ConfigEntry) -> None: """Run append in the executor.""" - service = Client(Credentials(entry.data[CONF_TOKEN][CONF_ACCESS_TOKEN])) + service = Client( + Credentials(entry.data[CONF_TOKEN][CONF_ACCESS_TOKEN]) # type: ignore[no-untyped-call] + ) try: sheet = service.open_by_key(entry.unique_id) except RefreshError: diff --git a/homeassistant/components/google_sheets/config_flow.py b/homeassistant/components/google_sheets/config_flow.py index a0a99742249..ab0c084c317 100644 --- a/homeassistant/components/google_sheets/config_flow.py +++ b/homeassistant/components/google_sheets/config_flow.py @@ -61,7 +61,9 @@ class OAuth2FlowHandler( async def async_oauth_create_entry(self, data: dict[str, Any]) -> ConfigFlowResult: """Create an entry for the flow, or update existing entry.""" - service = Client(Credentials(data[CONF_TOKEN][CONF_ACCESS_TOKEN])) + service = Client( + Credentials(data[CONF_TOKEN][CONF_ACCESS_TOKEN]) # type: ignore[no-untyped-call] + ) if self.reauth_entry: _LOGGER.debug("service.open_by_key") diff --git a/homeassistant/components/nest/api.py b/homeassistant/components/nest/api.py index 8c9ca4bec96..3ef26747115 100644 --- a/homeassistant/components/nest/api.py +++ b/homeassistant/components/nest/api.py @@ -57,7 +57,7 @@ class AsyncConfigEntryAuth(AbstractAuth): # even when it is expired to fully hand off this responsibility and # know it is working at startup (then if not, fail loudly). token = self._oauth_session.token - creds = Credentials( + creds = Credentials( # type: ignore[no-untyped-call] token=token["access_token"], refresh_token=token["refresh_token"], token_uri=OAUTH2_TOKEN, @@ -92,7 +92,7 @@ class AccessTokenAuthImpl(AbstractAuth): async def async_get_creds(self) -> Credentials: """Return an OAuth credential for Pub/Sub Subscriber.""" - return Credentials( + return Credentials( # type: ignore[no-untyped-call] token=self._access_token, token_uri=OAUTH2_TOKEN, scopes=SDM_SCOPES,