Use PEP 695 for function annotations (1) (#117658)

This commit is contained in:
Marc Mueller 2024-05-18 11:45:54 +02:00 committed by GitHub
parent 900b6211ef
commit 26a599ad11
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
20 changed files with 43 additions and 89 deletions

View file

@ -3,7 +3,7 @@
from abc import ABC, abstractmethod
from collections.abc import Callable
import logging
from typing import Any, TypeVar, cast
from typing import Any, cast
from fitbit import Fitbit
from fitbit.exceptions import HTTPException, HTTPUnauthorized
@ -24,9 +24,6 @@ CONF_REFRESH_TOKEN = "refresh_token"
CONF_EXPIRES_AT = "expires_at"
_T = TypeVar("_T")
class FitbitApi(ABC):
"""Fitbit client library wrapper base class.
@ -129,7 +126,7 @@ class FitbitApi(ABC):
dated_results: list[dict[str, Any]] = response[key]
return dated_results[-1]
async def _run(self, func: Callable[[], _T]) -> _T:
async def _run[_T](self, func: Callable[[], _T]) -> _T:
"""Run client command."""
try:
return await self._hass.async_add_executor_job(func)