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)
| 1054 | |
| 1055 | |
| 1056 | def _dynamic_class_reduce(obj): |
| 1057 | """Save a class that can't be referenced as a module attribute. |
| 1058 | |
| 1059 | This method is used to serialize classes that are defined inside |
| 1060 | functions, or that otherwise can't be serialized as attribute lookups |
| 1061 | from importable modules. |
| 1062 | """ |
| 1063 | if Enum is not None and issubclass(obj, Enum): |
| 1064 | return ( |
| 1065 | _make_skeleton_enum, |
| 1066 | _enum_getnewargs(obj), |
| 1067 | _enum_getstate(obj), |
| 1068 | None, |
| 1069 | None, |
| 1070 | _class_setstate, |
| 1071 | ) |
| 1072 | else: |
| 1073 | return ( |
| 1074 | _make_skeleton_class, |
| 1075 | _class_getnewargs(obj), |
| 1076 | _class_getstate(obj), |
| 1077 | None, |
| 1078 | None, |
| 1079 | _class_setstate, |
| 1080 | ) |
| 1081 | |
| 1082 | |
| 1083 | def _class_reduce(obj): |
no test coverage detected