(class_name, bases)
return member_type, first_enum
Returns the type for creating enum members, and the first inherited
        enum class.

        bases: the tuple of bases that was given to __new__
Returns the type for creating enum members, and the first inherited
        enum class.
Returns the type for creating enum members and the first inherited enum class .
def _get_mixins_(class_name, bases):
        """
        Returns the type for creating enum members, and the first inherited
        enum class.

        bases: the tuple of bases that was given to __new__
        """
        if not bases:
            return object, Enum

        def _find_data_type(bases):
            data_types = set()
            for chain in bases:
                candidate = None
                for base in chain.__mro__:
                    if base is object:
                        continue
                    elif issubclass(base, Enum):
                        if base._member_type_ is not object:
                            data_types.add(base._member_type_)
                            break
                    elif '__new__' in base.__dict__:
                        if issubclass(base, Enum):
                            continue
                        data_types.add(candidate or base)
                        break
                    else:
                        candidate = candidate or base
            if len(data_types) > 1:
                raise TypeError('%r: too many data types: %r' % (class_name, data_types))
            elif data_types:
                return data_types.pop()
            else:
                return None

        # ensure final parent class is an Enum derivative, find any concrete
        # data type, and check that Enum has no members
        first_enum = bases[-1]
        if not issubclass(first_enum, Enum):
            raise TypeError("new enumerations should be created as "
                    "`EnumName([mixin_type, ...] [data_type,] enum_type)`")
        member_type = _find_data_type(bases) or object
        if first_enum._member_names_:
            raise TypeError("Cannot extend enumerations")
        return member_type, first_enum
def _get_mixins_ ( class_name , bases ) : if not bases : return object , Enum def _find_data_type ( bases ) : data_types = set ( ) for chain in bases : candidate = None for base in chain . __mro__ : if base is object : continue elif issubclass ( base , Enum ) : if base . _member_type_ is not object : data_types . add ( base . _member_type_ ) break elif '__new__' in base . __dict__ : if issubclass ( base , Enum ) : continue data_types . add ( candidate or base ) break else : candidate = candidate or base if len ( data_types ) > 1 : raise TypeError ( '%r: too many data types: %r' % ( class_name , data_types ) ) elif data_types : return data_types . pop ( ) else : return None # ensure final parent class is an Enum derivative, find any concrete # data type, and check that Enum has no members first_enum = bases [ - 1 ] if not issubclass ( first_enum , Enum ) : raise TypeError ( "new enumerations should be created as " "`EnumName([mixin_type, ...] [data_type,] enum_type)`" ) member_type = _find_data_type ( bases ) or object if first_enum . _member_names_ : raise TypeError ( "Cannot extend enumerations" ) return member_type , first_enum