Update typing 14 (#48078)
This commit is contained in:
parent
7d196abc4a
commit
dcca29ef68
73 changed files with 614 additions and 521 deletions
|
@ -1,8 +1,10 @@
|
|||
"""Classes shared among Wemo entities."""
|
||||
from __future__ import annotations
|
||||
|
||||
import asyncio
|
||||
import contextlib
|
||||
import logging
|
||||
from typing import Any, Dict, Generator, Optional
|
||||
from typing import Any, Generator
|
||||
|
||||
import async_timeout
|
||||
from pywemo import WeMoDevice
|
||||
|
@ -19,7 +21,7 @@ class ExceptionHandlerStatus:
|
|||
"""Exit status from the _wemo_exception_handler context manager."""
|
||||
|
||||
# An exception if one was raised in the _wemo_exception_handler.
|
||||
exception: Optional[Exception] = None
|
||||
exception: Exception | None = None
|
||||
|
||||
@property
|
||||
def success(self) -> bool:
|
||||
|
@ -68,7 +70,7 @@ class WemoEntity(Entity):
|
|||
_LOGGER.info("Reconnected to %s", self.name)
|
||||
self._available = True
|
||||
|
||||
def _update(self, force_update: Optional[bool] = True):
|
||||
def _update(self, force_update: bool | None = True):
|
||||
"""Update the device state."""
|
||||
raise NotImplementedError()
|
||||
|
||||
|
@ -99,7 +101,7 @@ class WemoEntity(Entity):
|
|||
self._available = False
|
||||
|
||||
async def _async_locked_update(
|
||||
self, force_update: bool, timeout: Optional[async_timeout.timeout] = None
|
||||
self, force_update: bool, timeout: async_timeout.timeout | None = None
|
||||
) -> None:
|
||||
"""Try updating within an async lock."""
|
||||
async with self._update_lock:
|
||||
|
@ -124,7 +126,7 @@ class WemoSubscriptionEntity(WemoEntity):
|
|||
return self.wemo.serialnumber
|
||||
|
||||
@property
|
||||
def device_info(self) -> Dict[str, Any]:
|
||||
def device_info(self) -> dict[str, Any]:
|
||||
"""Return the device info."""
|
||||
return {
|
||||
"name": self.name,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue