CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
ntupleEnum._Enum Class Reference

Public Member Functions

def __init__ (self, **values)
 
def toString (self, val)
 

Private Attributes

 _reverse
 

Detailed Description

Definition at line 2 of file ntupleEnum.py.

Constructor & Destructor Documentation

◆ __init__()

def ntupleEnum._Enum.__init__ (   self,
**  values 
)

Definition at line 3 of file ntupleEnum.py.

3  def __init__(self, **values):
4  import six
5  self._reverse = {}
6  for key, value in six.iteritems(values):
7  setattr(self, key, value)
8  if value in self._reverse:
9  raise Exception("Value %s is already used for a key %s, tried to re-add it for key %s" % (value, self._reverse[value], key))
10  self._reverse[value] = key
11 

Member Function Documentation

◆ toString()

def ntupleEnum._Enum.toString (   self,
  val 
)

Definition at line 12 of file ntupleEnum.py.

12  def toString(self, val):
13  return self._reverse[val]
14 

References ntupleEnum._Enum._reverse.

Member Data Documentation

◆ _reverse

ntupleEnum._Enum._reverse
private

Definition at line 5 of file ntupleEnum.py.

Referenced by ntupleEnum._Enum.toString().

toolbox::toString
std::string toString(const char *format,...)
Definition: xdaq_compat.cc:4
Exception