11from __future__ import annotations
22
3- from typing import Any , SupportsInt , TypeVar , cast , overload
3+ from typing import Any , SupportsInt , cast , overload
44
55from pydantic import BaseModel , ConfigDict , Field , ValidationError , computed_field
66from xmltodict import parse as xml_parse
@@ -88,7 +88,8 @@ class TelemetryChlorinator(BaseModel):
8888 operating_mode : ChlorinatorOperatingMode | int = Field (alias = "@operatingMode" )
8989 enable : bool = Field (alias = "@enable" )
9090
91- @computed_field
91+ @computed_field # type: ignore[prop-decorator]
92+ @property
9293 def status (self ) -> list [str ]:
9394 """Decode status bitmask into a list of active status flag names.
9495
@@ -101,7 +102,8 @@ def status(self) -> list[str]:
101102 """
102103 return [flag .name for flag in ChlorinatorStatus if self .status_raw & flag .value and flag .name is not None ]
103104
104- @computed_field
105+ @computed_field # type: ignore[prop-decorator]
106+ @property
105107 def alerts (self ) -> list [str ]:
106108 """Decode chlrAlert bitmask into a list of active alert flag names.
107109
@@ -131,7 +133,8 @@ def alerts(self) -> list[str]:
131133
132134 return final_flags
133135
134- @computed_field
136+ @computed_field # type: ignore[prop-decorator]
137+ @property
135138 def errors (self ) -> list [str ]:
136139 """Decode chlrError bitmask into a list of active error flag names.
137140
@@ -161,7 +164,8 @@ def errors(self) -> list[str]:
161164
162165 return final_flags
163166
164- @computed_field
167+ @computed_field # type: ignore[prop-decorator]
168+ @property
165169 def active (self ) -> bool :
166170 """Check if the chlorinator is actively generating chlorine.
167171
@@ -326,15 +330,10 @@ class Telemetry(BaseModel):
326330
327331 @staticmethod
328332 def load_xml (xml : str ) -> Telemetry :
329- TypeVar ("KT" )
330- TypeVar ("VT" , SupportsInt , Any )
331-
332333 @overload
333334 def xml_postprocessor (path : Any , key : Any , value : SupportsInt ) -> tuple [Any , SupportsInt ]: ...
334-
335335 @overload
336336 def xml_postprocessor (path : Any , key : Any , value : Any ) -> tuple [Any , Any ]: ...
337-
338337 def xml_postprocessor (path : Any , key : Any , value : SupportsInt | Any ) -> tuple [Any , SupportsInt | Any ]:
339338 """Post process XML to attempt to convert values to int.
340339
0 commit comments