Skip to content

Commit e0065b6

Browse files
committed
Fix mutable default values in dataclass
Fixes #3
1 parent 563a092 commit e0065b6

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

karcher/device.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ class DeviceProperties:
101101
main_brush: int = 0
102102
side_brush: int = 0
103103
mop_life: int = 0
104-
net_status: DevicePropertiesNetwork = DevicePropertiesNetwork()
104+
net_status: DevicePropertiesNetwork
105105
repeat_state: int = 0
106106
tank_state: int = 0
107107
cloth_state: int = 0
@@ -121,7 +121,7 @@ class DeviceProperties:
121121
charge_state: int = 0
122122
back_to_wash: int = 0
123123
break_charging: int = 0
124-
order_total: DevicePropertiesOrderTotal = DevicePropertiesOrderTotal()
124+
order_total: DevicePropertiesOrderTotal
125125
memory_map: int = 0
126126
current_map_id: int = 0
127127
map_num: int = 0
@@ -131,15 +131,19 @@ class DeviceProperties:
131131
quiet_begin_time: int = 0
132132
quiet_end_time: int = 0
133133
broken_clean: int = 0
134-
privacy: DevicePropertiesPrivacy = DevicePropertiesPrivacy()
134+
privacy: DevicePropertiesPrivacy
135135
cur_path: List[float]
136136
dust_action: int = 0
137137
voice_type: int = 0
138-
quiet_status: DevicePropertiesQuiet = DevicePropertiesQuiet()
138+
quiet_status: DevicePropertiesQuiet
139139
last_update_time: int = 0
140140

141141
def __init__(self, **kwargs):
142142
setattr(self, 'cur_path', [])
143+
setattr(self, 'net_stauts', DevicePropertiesNetwork())
144+
setattr(self, 'order_total', DevicePropertiesOrderTotal())
145+
setattr(self, 'privacy', DevicePropertiesPrivacy())
146+
setattr(self, 'quiet_status', DevicePropertiesQuiet())
143147
self.update(kwargs)
144148

145149
def update(self, data: dict[str, Any]) -> bool:

0 commit comments

Comments
 (0)