MCPcopy Create free account
hub / github.com/apache/fory / to_dict

Function to_dict

python/pyfory/tests/test_cross_language.py:47–56  ·  view source on GitHub ↗

Convert an object to a dictionary for comparison.

(obj)

Source from the content-addressed store, hash-verified

45
46
47def to_dict(obj):
48 """Convert an object to a dictionary for comparison."""
49 if hasattr(obj, "as_dict"):
50 return obj.as_dict()
51 elif hasattr(obj, "__dataclass_fields__"):
52 from dataclasses import asdict
53
54 return asdict(obj)
55 else:
56 return obj
57
58
59def cross_language_test(test_func):

Callers 2

test_map_encoderFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected