Update DiscoveryResult to use mashu Annotated Alias (#1279)

This commit is contained in:
Steven B. 2024-11-19 19:09:50 +00:00 committed by GitHub
parent e1e6d72222
commit 2683623997
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -92,18 +92,19 @@ import struct
from asyncio import timeout as asyncio_timeout from asyncio import timeout as asyncio_timeout
from asyncio.transports import DatagramTransport from asyncio.transports import DatagramTransport
from collections.abc import Callable, Coroutine from collections.abc import Callable, Coroutine
from dataclasses import dataclass, field from dataclasses import dataclass
from pprint import pformat as pf from pprint import pformat as pf
from typing import ( from typing import (
TYPE_CHECKING, TYPE_CHECKING,
Annotated,
Any, Any,
NamedTuple, NamedTuple,
cast, cast,
) )
from aiohttp import ClientSession from aiohttp import ClientSession
from mashumaro import field_options
from mashumaro.config import BaseConfig from mashumaro.config import BaseConfig
from mashumaro.types import Alias
from kasa import Device from kasa import Device
from kasa.credentials import Credentials from kasa.credentials import Credentials
@ -851,9 +852,7 @@ class DiscoveryResult(_DiscoveryBaseMixin):
encrypt_info: EncryptionInfo | None = None encrypt_info: EncryptionInfo | None = None
encrypt_type: list[str] | None = None encrypt_type: list[str] | None = None
decrypted_data: dict | None = None decrypted_data: dict | None = None
is_reset_wifi: bool | None = field( is_reset_wifi: Annotated[bool | None, Alias("isResetWiFi")] = None
metadata=field_options(alias="isResetWiFi"), default=None
)
firmware_version: str | None = None firmware_version: str | None = None
hardware_version: str | None = None hardware_version: str | None = None