Commit 6c30e93
committed
fix uninitialized property
When the robot is idle, parked at the base, and I call
`kh.get_device_properties(dev)`, I get back the following backtrace
(after removing some asyncio layers due to awaits):
File "/nix/store/asiphbpiy2gmidfm3xbwcikayhs66289-python3-3.11.7/lib/python3.11/dataclasses.py", line 240, in wrapper
result = user_function(self)
^^^^^^^^^^^^^^^^^^^
File "<string>", line 3, in __repr__
AttributeError: 'DeviceProperties' object has no attribute 'net_status'. Did you mean: 'net_stauts'?
What's particularly funny is that when run as `python -m asyncio`, to
get the `await` working in the REPL, the exception does not contain that
useful hint, and it looks like the following instead:
>>> kh.get_device_properties(d[0])
Traceback (most recent call last):
File "/nix/store/asiphbpiy2gmidfm3xbwcikayhs66289-python3-3.11.7/lib/python3.11/concurrent/futures/_base.py", line 456, in result
return self.__get_result()
^^^^^^^^^^^^^^^^^^^
File "/nix/store/asiphbpiy2gmidfm3xbwcikayhs66289-python3-3.11.7/lib/python3.11/concurrent/futures/_base.py", line 401, in __get_result
raise self._exception
File "/nix/store/asiphbpiy2gmidfm3xbwcikayhs66289-python3-3.11.7/lib/python3.11/asyncio/__main__.py", line 34, in callback
coro = func()
^^^^^^
File "<console>", line 1, in <module>
File "/nix/store/asiphbpiy2gmidfm3xbwcikayhs66289-python3-3.11.7/lib/python3.11/dataclasses.py", line 240, in wrapper
result = user_function(self)
^^^^^^^^^^^^^^^^^^^
File "<string>", line 3, in __repr__
AttributeError: 'DeviceProperties' object has no attribute 'net_status'
Anyway, the root cause was just a typo in DeviceProperties.__init__.
Fixes: e0065b6 Fix mutable default values in dataclass1 parent 9e2c1ec commit 6c30e93
1 file changed
+1
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
140 | 140 | | |
141 | 141 | | |
142 | 142 | | |
143 | | - | |
| 143 | + | |
144 | 144 | | |
145 | 145 | | |
146 | 146 | | |
| |||
0 commit comments