Update typing 05 (#48038)

This commit is contained in:
Marc Mueller
2021-03-17 23:43:55 +01:00
committed by GitHub
parent 76199c0eb2
commit 7c0734bdd5
57 changed files with 315 additions and 251 deletions

View File

@@ -1,8 +1,10 @@
"""Interface implementation for cloud client."""
from __future__ import annotations
import asyncio
import logging
from pathlib import Path
from typing import Any, Dict
from typing import Any
import aiohttp
from hass_nabucasa.client import CloudClient as Interface
@@ -32,8 +34,8 @@ class CloudClient(Interface):
hass: HomeAssistantType,
prefs: CloudPreferences,
websession: aiohttp.ClientSession,
alexa_user_config: Dict[str, Any],
google_user_config: Dict[str, Any],
alexa_user_config: dict[str, Any],
google_user_config: dict[str, Any],
):
"""Initialize client interface to Cloud."""
self._hass = hass
@@ -70,7 +72,7 @@ class CloudClient(Interface):
return self._hass.http.runner
@property
def cloudhooks(self) -> Dict[str, Dict[str, str]]:
def cloudhooks(self) -> dict[str, dict[str, str]]:
"""Return list of cloudhooks."""
return self._prefs.cloudhooks
@@ -164,7 +166,7 @@ class CloudClient(Interface):
if identifier.startswith("remote_"):
async_dispatcher_send(self._hass, DISPATCHER_REMOTE_UPDATE, data)
async def async_alexa_message(self, payload: Dict[Any, Any]) -> Dict[Any, Any]:
async def async_alexa_message(self, payload: dict[Any, Any]) -> dict[Any, Any]:
"""Process cloud alexa message to client."""
cloud_user = await self._prefs.get_cloud_user()
aconfig = await self.get_alexa_config()
@@ -176,7 +178,7 @@ class CloudClient(Interface):
enabled=self._prefs.alexa_enabled,
)
async def async_google_message(self, payload: Dict[Any, Any]) -> Dict[Any, Any]:
async def async_google_message(self, payload: dict[Any, Any]) -> dict[Any, Any]:
"""Process cloud google message to client."""
if not self._prefs.google_enabled:
return ga.turned_off_response(payload)
@@ -187,7 +189,7 @@ class CloudClient(Interface):
self._hass, gconf, gconf.cloud_user, payload, gc.SOURCE_CLOUD
)
async def async_webhook_message(self, payload: Dict[Any, Any]) -> Dict[Any, Any]:
async def async_webhook_message(self, payload: dict[Any, Any]) -> dict[Any, Any]:
"""Process cloud webhook message to client."""
cloudhook_id = payload["cloudhook_id"]
@@ -221,6 +223,6 @@ class CloudClient(Interface):
"headers": {"Content-Type": response.content_type},
}
async def async_cloudhooks_update(self, data: Dict[str, Dict[str, str]]) -> None:
async def async_cloudhooks_update(self, data: dict[str, dict[str, str]]) -> None:
"""Update local list of cloudhooks."""
await self._prefs.async_update(cloudhooks=data)