MCPcopy Create free account
hub / github.com/InternRobotics/OpenHomie / class_to_dict

Function class_to_dict

HomieDeploy/g1_gym_deploy/utils/logger.py:8–24  ·  view source on GitHub ↗
(obj)

Source from the content-addressed store, hash-verified

6
7
8def class_to_dict(obj) -> dict:
9 if not hasattr(obj, "__dict__"):
10 return obj
11 result = {}
12 for key in dir(obj):
13 if key.startswith("_") or key == "terrain":
14 continue
15 element = []
16 val = getattr(obj, key)
17 if isinstance(val, list):
18 for item in val:
19 element.append(class_to_dict(item))
20 else:
21 print(key)
22 element = class_to_dict(val)
23 result[key] = element
24 return result
25
26
27class MultiLogger:

Callers 1

saveMethod · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected