can do this if we're desperate for the last few %

pull/33208/head
Shane Smiskol 8 months ago
parent a5e363d8db
commit 18e11ac788
  1. 10
      selfdrive/car/card.py

@ -80,10 +80,14 @@ def asdictref(obj) -> dict[str, Any]:
for field in getattr(obj, _FIELDS): # similar to dataclasses.fields()
ret[field] = _asdictref_inner(getattr(obj, field))
return ret
elif isinstance(obj, (tuple, list)):
return type(obj)(_asdictref_inner(v) for v in obj)
else:
return obj
obj_type = type(obj)
if obj_type is list:
return [_asdictref_inner(v) for v in obj]
elif obj_type is tuple:
return tuple(_asdictref_inner(v) for v in obj)
else:
return obj
return _asdictref_inner(obj)

Loading…
Cancel
Save