(cls, class_name, names, *, module=None, qualname=None, type=None, start=1)
return enum_class
Convenience method to create a new Enum class.

        `names` can be:

        * A string containing member names, separated either with spaces or
          commas.  Values are incremented by 1 from `start`.
        * An iterable of member names.  Values are incremented by 1 from `start`.
        * An iterable of (member name, value) pairs.
        * A mapping of member name -> value pairs.
Convenience method to create a new Enum class.
Convenience method to create a new Enum class .
def _create_(cls, class_name, names, *, module=None, qualname=None, type=None, start=1):
        """
        Convenience method to create a new Enum class.

        `names` can be:

        * A string containing member names, separated either with spaces or
          commas.  Values are incremented by 1 from `start`.
        * An iterable of member names.  Values are incremented by 1 from `start`.
        * An iterable of (member name, value) pairs.
        * A mapping of member name -> value pairs.
        """
        metacls = cls.__class__
        bases = (cls, ) if type is None else (type, cls)
        _, first_enum = cls._get_mixins_(cls, bases)
        classdict = metacls.__prepare__(class_name, bases)

        # special processing needed for names?
        if isinstance(names, str):
            names = names.replace(',', ' ').split()
        if isinstance(names, (tuple, list)) and names and isinstance(names[0], str):
            original_names, names = names, []
            last_values = []
            for count, name in enumerate(original_names):
                value = first_enum._generate_next_value_(name, start, count, last_values[:])
                last_values.append(value)
                names.append((name, value))

        # Here, names is either an iterable of (name, value) or a mapping.
        for item in names:
            if isinstance(item, str):
                member_name, member_value = item, names[item]
            else:
                member_name, member_value = item
            classdict[member_name] = member_value
        enum_class = metacls.__new__(metacls, class_name, bases, classdict)

        # TODO: replace the frame hack if a blessed way to know the calling
        # module is ever developed
        if module is None:
            try:
                module = sys._getframe(2).f_globals['__name__']
            except (AttributeError, ValueError, KeyError):
                pass
        if module is None:
            _make_class_unpicklable(enum_class)
        else:
            enum_class.__module__ = module
        if qualname is not None:
            enum_class.__qualname__ = qualname

        return enum_class
def _create_ ( cls , class_name , names , * , module = None , qualname = None , type = None , start = 1 ) : metacls = cls . __class__ bases = ( cls , ) if type is None else ( type , cls ) _ , first_enum = cls . _get_mixins_ ( cls , bases ) classdict = metacls . __prepare__ ( class_name , bases ) # special processing needed for names? if isinstance ( names , str ) : names = names . replace ( ',' , ' ' ) . split ( ) if isinstance ( names , ( tuple , list ) ) and names and isinstance ( names [ 0 ] , str ) : original_names , names = names , [ ] last_values = [ ] for count , name in enumerate ( original_names ) : value = first_enum . _generate_next_value_ ( name , start , count , last_values [ : ] ) last_values . append ( value ) names . append ( ( name , value ) ) # Here, names is either an iterable of (name, value) or a mapping. for item in names : if isinstance ( item , str ) : member_name , member_value = item , names [ item ] else : member_name , member_value = item classdict [ member_name ] = member_value enum_class = metacls . __new__ ( metacls , class_name , bases , classdict ) # TODO: replace the frame hack if a blessed way to know the calling # module is ever developed if module is None : try : module = sys . _getframe ( 2 ) . f_globals [ '__name__' ] except ( AttributeError , ValueError , KeyError ) : pass if module is None : _make_class_unpicklable ( enum_class ) else : enum_class . __module__ = module if qualname is not None : enum_class . __qualname__ = qualname return enum_class