mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 05:07:41 +00:00
Use classmethod in Tuya TypeData classes (#57627)
This commit is contained in:
parent
158dd1556c
commit
b854a2537f
@ -26,10 +26,10 @@ class IntegerTypeData:
|
||||
scale: float
|
||||
step: float
|
||||
|
||||
@staticmethod
|
||||
def from_json(data: str) -> IntegerTypeData:
|
||||
@classmethod
|
||||
def from_json(cls, data: str) -> IntegerTypeData:
|
||||
"""Load JSON string and return a IntegerTypeData object."""
|
||||
return IntegerTypeData(**json.loads(data))
|
||||
return cls(**json.loads(data))
|
||||
|
||||
|
||||
@dataclass
|
||||
@ -38,10 +38,10 @@ class EnumTypeData:
|
||||
|
||||
range: list[str]
|
||||
|
||||
@staticmethod
|
||||
def from_json(data: str) -> EnumTypeData:
|
||||
@classmethod
|
||||
def from_json(cls, data: str) -> EnumTypeData:
|
||||
"""Load JSON string and return a EnumTypeData object."""
|
||||
return EnumTypeData(**json.loads(data))
|
||||
return cls(**json.loads(data))
|
||||
|
||||
|
||||
class TuyaHaEntity(Entity):
|
||||
|
Loading…
x
Reference in New Issue
Block a user