(self, obj, clsdict)
Special handling for dynamic Enum subclasses

        Use a dedicated Enum constructor (inspired by EnumMeta.__call__) as the
        EnumMeta metaclass has complex initialization that makes the Enum
        subclasses hold references to their own instances.
Special handling for dynamic Enum subclasses
Special handling for dynamic Enum subclasses
def _save_dynamic_enum(self, obj, clsdict):
        """Special handling for dynamic Enum subclasses

        Use a dedicated Enum constructor (inspired by EnumMeta.__call__) as the
        EnumMeta metaclass has complex initialization that makes the Enum
        subclasses hold references to their own instances.
        """
        members = dict((e.name, e.value) for e in obj)

        # Python 2.7 with enum34 can have no qualname:
        qualname = getattr(obj, "__qualname__", None)

        self.save_reduce(
            _make_skeleton_enum,
            (
                obj.__bases__,
                obj.__name__,
                qualname,
                members,
                obj.__module__,
                _ensure_tracking(obj),
                None,
            ),
            obj=obj,
        )

        # Cleanup the clsdict that will be passed to _rehydrate_skeleton_class:
        # Those attributes are already handled by the metaclass.
        for attrname in [
            "_generate_next_value_",
            "_member_names_",
            "_member_map_",
            "_member_type_",
            "_value2member_map_",
        ]:
            clsdict.pop(attrname, None)
        for member in members:
            clsdict.pop(member)
def _save_dynamic_enum ( self , obj , clsdict ) : members = dict ( ( e . name , e . value ) for e in obj ) # Python 2.7 with enum34 can have no qualname: qualname = getattr ( obj , "__qualname__" , None ) self . save_reduce ( _make_skeleton_enum , ( obj . __bases__ , obj . __name__ , qualname , members , obj . __module__ , _ensure_tracking ( obj ) , None , ) , obj = obj , ) # Cleanup the clsdict that will be passed to _rehydrate_skeleton_class: # Those attributes are already handled by the metaclass. for attrname in [ "_generate_next_value_" , "_member_names_" , "_member_map_" , "_member_type_" , "_value2member_map_" , ] : clsdict . pop ( attrname , None ) for member in members : clsdict . pop ( member )