class_docstr: Metaclass for Enum
class_docstr_tok: ["Metaclass","for","Enum"]
docstr: Convenience method to create a new Enum class.
  
  `names` can be:
  
  * A string containing member names, separated either with spaces or
    commas.  Values are auto-numbered from 1.
  * An iterable of member names.  Values are auto-numbered from 1.
  * An iterable of (member name, value) pairs.
  * A mapping of member name -> value.
docstr_tok: ["Convenience","method","to","create","a","new","Enum","class",".","`","names","`","can","be",":","*","A","string","containing","member","names",",","separated","either","with","spaces","or","commas",".","Values","are","auto-numbered","from","1",".","*","An","iterable","of","member","names",".","Values","are","auto-numbered","from","1",".","*","An","iterable","of","(","member","name",",","value",")","pairs",".","*","A","mapping","of","member","name","-",">","value","."]
code: def _create_(
      cls, class_name, names=None, module=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 auto-numbered from 1.
      * An iterable of member names.  Values are auto-numbered from 1.
      * An iterable of (member name, value) pairs.
      * A mapping of member name -> value.
  
      """
      if pyver < 3.0:
          # if class_name is unicode, attempt a conversion to ASCII
          if isinstance(class_name, unicode):
              try:
                  class_name = class_name.encode("ascii")
              except UnicodeEncodeError:
                  raise TypeError(
                      "%r is not representable in ASCII" % class_name
                  )
      metacls = cls.__class__
      if type is None:
          bases = (cls,)
      else:
          bases = (type, cls)
      classdict = metacls.__prepare__(class_name, bases)
      _order_ = []
  
      # special processing needed for names?
      if isinstance(names, basestring):
          names = names.replace(",", " ").split()
      if isinstance(names, (tuple, list)) and isinstance(
          names[0], basestring
      ):
          names = [(e, i + start) for (i, e) in enumerate(names)]
  
      # Here, names is either an iterable of (name, value) or a mapping.
      item = None  # in case names is empty
      for item in names:
          if isinstance(item, basestring):
              member_name, member_value = item, names[item]
          else:
              member_name, member_value = item
          classdict[member_name] = member_value
          _order_.append(member_name)
      # only set _order_ in classdict if name/value was not from a mapping
      if not isinstance(item, basestring):
          classdict["_order_"] = " ".join(_order_)
      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):
              pass
      if module is None:
          _make_class_unpicklable(enum_class)
      else:
          enum_class.__module__ = module
  
      return enum_class
  
imports: import sys
label_desc: Use image node_id 16 for calling the EnumMeta obj's underlying member method code with example usage: obj._create_(cls, class_name, names, module, type, start) and returns: enum_class