| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent d65ec91 commit cd26ea1
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -33,12 +33,11 @@ | |||
| 33 | 33 | import logging | |
| 34 | 34 | from dataclasses import dataclass, field, replace | |
| 35 | 35 | from enum import Enum | |
| 36 | - from typing import TYPE_CHECKING, Any, Self, TypedDict | ||
| 36 | + from typing import TYPE_CHECKING, TypedDict | ||
| 37 | 37 | ||
| 38 | 38 | from aiohttp import ClientSession | |
| 39 | - from mashumaro import field_options | ||
| 39 | + from mashumaro import field_options, pass_through | ||
| 40 | 40 | from mashumaro.config import BaseConfig | |
| 41 | - from mashumaro.types import SerializationStrategy | ||
| 42 | 41 | ||
| 43 | 42 | from .credentials import Credentials | |
| 44 | 43 | from .exceptions import KasaException | |
@@ -122,14 +121,6 @@ def from_values( | |||
| 122 | 121 | ) from ex | |
| 123 | 122 | ||
| 124 | 123 | ||
| 125 | - class _DoNotSerialize(SerializationStrategy): | ||
| 126 | - def serialize(self, value: Any) -> None: | ||
| 127 | - return None # pragma: no cover | ||
| 128 | - | ||
| 129 | - def deserialize(self, value: Any) -> None: | ||
| 130 | - return None # pragma: no cover | ||
| 131 | - | ||
| 132 | - | ||
| 133 | 124 | @dataclass | |
| 134 | 125 | class DeviceConfig(_DeviceConfigBaseMixin): | |
| 135 | 126 | """Class to represent paramaters that determine how to connect to devices.""" | |
@@ -163,7 +154,7 @@ class DeviceConfig(_DeviceConfigBaseMixin): | |||
| 163 | 154 | http_client: ClientSession | None = field( | |
| 164 | 155 | default=None, | |
| 165 | 156 | compare=False, | |
| 166 | - metadata=field_options(serialization_strategy=_DoNotSerialize()), | ||
| 157 | + metadata=field_options(serialize="omit", deserialize=pass_through), | ||
| 167 | 158 | ) | |
| 168 | 159 | ||
| 169 | 160 | aes_keys: KeyPairDict | None = None | |
@@ -174,9 +165,6 @@ def __post_init__(self) -> None: | |||
| 174 | 165 | DeviceFamily.IotSmartPlugSwitch, DeviceEncryptionType.Xor | |
| 175 | 166 | ) | |
| 176 | 167 | ||
| 177 | - def __pre_serialize__(self) -> Self: | ||
| 178 | - return replace(self, http_client=None) | ||
| 179 | - | ||
| 180 | 168 | def to_dict_control_credentials( | |
| 181 | 169 | self, | |
| 182 | 170 | *, | |
| Back | FazBrowse Home | New Git URL |
0 commit comments