Skip to content

Commit

Permalink
Use X | Y for type annotations (#617)
Browse files Browse the repository at this point in the history
yuvalabou authored Oct 16, 2023

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
1 parent 32e07b4 commit a13cafe
Showing 2 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions custom_components/smartthinq_sensors/wideq/core_async.py
Original file line number Diff line number Diff line change
@@ -13,7 +13,7 @@
import os
import ssl
import sys
from typing import Any, Optional
from typing import Any
from urllib.parse import (
ParseResult,
parse_qs,
@@ -1234,7 +1234,7 @@ class ClientAsync:
def __init__(
self,
auth: Auth,
session: Optional[Session] = None,
session: Session | None = None,
country: str = DEFAULT_COUNTRY,
language: str = DEFAULT_LANGUAGE,
*,
@@ -1243,7 +1243,7 @@ def __init__(
"""Initialize the client."""
# The three steps required to get access to call the API.
self._auth: Auth = auth
self._session: Optional[Session] = session
self._session: Session | None = session
self._last_device_update = datetime.utcnow()
self._lock = asyncio.Lock()
# The last list of devices we got from the server. This is the
10 changes: 5 additions & 5 deletions custom_components/smartthinq_sensors/wideq/device_info.py
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@

from enum import Enum
import logging
from typing import Any, Optional
from typing import Any

from .const import StateOptions

@@ -161,12 +161,12 @@ def model_name(self) -> str:
return self._get_data_value(["modelName", "modelNm"])

@property
def macaddress(self) -> Optional[str]:
def macaddress(self) -> str | None:
"""Return the device mac address."""
return self._data.get("macAddress")

@property
def firmware(self) -> Optional[str]:
def firmware(self) -> str | None:
"""Return the device firmware version."""
if fw_ver := self._data.get("fwVer"):
return fw_ver
@@ -240,11 +240,11 @@ def network_type(self) -> NetworkType:
return self._network_type

@property
def device_state(self) -> Optional[str]:
def device_state(self) -> str | None:
"""Return the status associated to the device."""
return self._data.get("deviceState")

@property
def snapshot(self) -> Optional[dict[str, Any]]:
def snapshot(self) -> dict[str, Any] | None:
"""Return the snapshot data associated to the device."""
return self._data.get("snapshot")

0 comments on commit a13cafe

Please sign in to comment.