MCPcopy
hub / github.com/cloudpipe/cloudpickle / _dynamic_class_reduce

Function _dynamic_class_reduce

cloudpickle/cloudpickle.py:1042–1066  ·  view source on GitHub ↗

Save a class that can't be referenced as a module attribute. This method is used to serialize classes that are defined inside functions, or that otherwise can't be serialized as attribute lookups from importable modules.

(obj)

Source from the content-addressed store, hash-verified

1040
1041
1042def _dynamic_class_reduce(obj):
1043 """Save a class that can't be referenced as a module attribute.
1044
1045 This method is used to serialize classes that are defined inside
1046 functions, or that otherwise can't be serialized as attribute lookups
1047 from importable modules.
1048 """
1049 if Enum is not None and issubclass(obj, Enum):
1050 return (
1051 _make_skeleton_enum,
1052 _enum_getnewargs(obj),
1053 _enum_getstate(obj),
1054 None,
1055 None,
1056 _class_setstate,
1057 )
1058 else:
1059 return (
1060 _make_skeleton_class,
1061 _class_getnewargs(obj),
1062 _class_getstate(obj),
1063 None,
1064 None,
1065 _class_setstate,
1066 )
1067
1068
1069def _class_reduce(obj):

Callers 2

_class_reduceFunction · 0.85
save_globalMethod · 0.85

Calls 4

_enum_getnewargsFunction · 0.85
_enum_getstateFunction · 0.85
_class_getnewargsFunction · 0.85
_class_getstateFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…