# `Enumeration`

digraph inheritance6941a6420b { bgcolor=transparent; rankdir=UD; ratio=compress; size="8.0, 12.0"; "Enumeration" [URL="#taurus.core.util.enumeration.Enumeration",color=dodgerblue1,fillcolor=white,fontcolor=black,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.5,shape=box,style=rounded,target="_top",tooltip="Enumeration class intended to provide the 'enum' feature present in many"]; }

class Enumeration(name, enumList, flaggable=False, no_doc=False)

  Enumeration class intended to provide the ‘enum’ feature present in many programming languages.

  The elements of the enumeration can be accessed in an “object member way” or as elements of a dictionary.

  Usage:

      from taurus.core.util.enumeration import Enumeration

      Volkswagen = Enumeration("Volkswagen",
          ["JETTA",
           "RABBIT",
           "BEETLE",
           ("THING", 400),
           "PASSAT",
           "GOLF",
           ("CABRIO", 700),
           "EURO_VAN",
           "CLASSIC_BEETLE",
           "CLASSIC_VAN"
           ])

  In the command line:

      >>> my_car = Volkswagen.BEETLE
      >>> homer_car = Volkswagen.PASSAT

      >>> print(Volkswagen.BEETLE)
      2

      >>> print(Volkswagen['BEETLE'])
      2

      >>>print(Volkswagen.whatis(homer_car))
      'PASSAT'

  Import from `taurus.core.util.enumeration` as:

      from taurus.core.util.enumeration import Enumeration

  get(i)

    Returns the element for the given key/value

  has_key(key)

    Determines if the enumeration contains the given key

    Parameters:

      key (str) – the key

    Returns:

      True if the key is in the enumeration or False otherswise

    Return type:

      bool

  keys()

    Returns an iterable containning the valid enumeration keys

    Returns:

      an interable containning the valid enumeration keys

    Return type:

      iter<str>

  whatis(value)

    Returns a string representation of the value in the enumeration. :param value: a valid enumeration element :return: a string representation of the given enumeration element :rtype: str