CMS 3D CMS Logo

List of all members | Public Member Functions | Public Attributes
diclist.diclist Class Reference
Inheritance diagram for diclist.diclist:

Public Member Functions

def __getitem__ (self, index)
 
def __init__ (self)
 
def __setitem__ (self, index, value)
 
def add (self, key, value)
 

Public Attributes

 dico
 

Detailed Description

list with an internal dictionary for indexing, 
allowing to keep dictionary elements ordered. 
keys can be everything except an integer.

Definition at line 4 of file diclist.py.

Constructor & Destructor Documentation

◆ __init__()

def diclist.diclist.__init__ (   self)

Definition at line 10 of file diclist.py.

10  def __init__(self):
11  super( diclist, self).__init__()
12  # internal dictionary, will contain key -> index in list
13  self.dico = {}
14 
def __init__(self, dataset, job_number, job_id, job_name, isDA, isMC, applyBOWS, applyEXTRACOND, extraconditions, runboundary, lumilist, intlumi, maxevents, gt, allFromGT, alignmentDB, alignmentTAG, apeDB, apeTAG, bowDB, bowTAG, vertextype, tracktype, refittertype, ttrhtype, applyruncontrol, ptcut, CMSSW_dir, the_dir)

Member Function Documentation

◆ __getitem__()

def diclist.diclist.__getitem__ (   self,
  index 
)
index can be a dictionary key, or an integer specifying
the rank of the value to be accessed

Definition at line 23 of file diclist.py.

References diclist.diclist.dico.

23  def __getitem__(self, index):
24  '''index can be a dictionary key, or an integer specifying
25  the rank of the value to be accessed
26  '''
27  try:
28  # if index is an integer (the rank), use the list.
29  return super(diclist, self).__getitem__(index)
30  except (TypeError, ValueError):
31  # else it's the dictionary key.
32  # use the internal dictionary to get the index,
33  # and return the corresponding value from the list
34  return super(diclist, self).__getitem__( self.dico[index] )
35 

◆ __setitem__()

def diclist.diclist.__setitem__ (   self,
  index,
  value 
)
These functions are quite risky...

Definition at line 36 of file diclist.py.

References diclist.diclist.dico.

36  def __setitem__(self, index, value):
37  '''These functions are quite risky...'''
38  try:
39  return super(diclist, self).__setitem__(index, value)
40  except TypeError as ValueError:
41  return super(diclist, self).__setitem__( self.dico[index], value )
42 
43 
44 
45 

◆ add()

def diclist.diclist.add (   self,
  key,
  value 
)

Definition at line 15 of file diclist.py.

References reco::ClusterCompatibility.append(), ecaldqm::Dependency.append(), cms::Digest.append(), L1GtVhdlTemplateFile.append(), NoProxyException< T > ex.append(), NoProxyException< DataT > ex.append(), NoProxyException< DataT >.append(), cms::Exception.append(), psClasses.BuildTreeNodeList.append(), svgfig.SVG.append(), psClasses.queueNode.append(), Json::Value.append(), Mixins._ValidatingListBase.append(), plotting.PlotGroup.append(), plotting.PlotOnSideGroup.append(), plotting.PlotFolder.append(), plotting.Plotter.append(), and diclist.diclist.dico.

Referenced by counter.Counter.register().

15  def add( self, key, value ):
16  if isinstance(key, (int, long)):
17  raise ValueError("key cannot be an integer")
18  if key in self.dico:
19  raise ValueError("key '{key}' already exists".format(key=key) )
20  self.dico[key] = len(self)
21  self.append(value)
22 
void add(std::map< std::string, TH1 *> &h, TH1 *hist)

Member Data Documentation

◆ dico

diclist.diclist.dico