CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
python.XML2Python.DataNode Class Reference
Inheritance diagram for python.XML2Python.DataNode:

Public Member Functions

def __contains__ (self, name)
 
def __getattr__ (self, name)
 
def __getitem__ (self, key)
 
def __init__ (self, kwargs)
 
def __len__ (self)
 
def __nonzero__ (self)
 
def __repr__ (self)
 
def __str__ (self)
 
def attributes (self)
 

Private Member Functions

def _add_xml_attr (self, name, value)
 

Private Attributes

 _attrs
 
 _data
 
 _ncDict
 

Detailed Description

Definition at line 9 of file XML2Python.py.

Constructor & Destructor Documentation

◆ __init__()

def python.XML2Python.DataNode.__init__ (   self,
  kwargs 
)

Definition at line 11 of file XML2Python.py.

11  def __init__ (self, **kwargs):
12  self._attrs = {} # XML attributes and child elements
13  self._data = None # child text data
14  self._ncDict = kwargs.get ('nameChangeDict', {})
15 
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

◆ __contains__()

def python.XML2Python.DataNode.__contains__ (   self,
  name 
)

Definition at line 26 of file XML2Python.py.

References python.XML2Python.DataNode._attrs, and XML2Python.DataNode._attrs.

26  def __contains__ (self, name):
27  return name in self._attrs
28 

◆ __getattr__()

def python.XML2Python.DataNode.__getattr__ (   self,
  name 
)

Definition at line 32 of file XML2Python.py.

References python.XML2Python.DataNode._attrs, and XML2Python.DataNode._attrs.

32  def __getattr__ (self, name):
33  if name.startswith('__'):
34  # need to do this for Python special methods???
35  raise AttributeError (name)
36  return self._attrs.get (name, None)
37 

◆ __getitem__()

def python.XML2Python.DataNode.__getitem__ (   self,
  key 
)

Definition at line 20 of file XML2Python.py.

References python.XML2Python.DataNode._attrs, and XML2Python.DataNode._attrs.

20  def __getitem__ (self, key):
21  if isinstance (key, str):
22  return self._attrs.get(key,None)
23  else:
24  return [self][key]
25 

◆ __len__()

def python.XML2Python.DataNode.__len__ (   self)

Definition at line 16 of file XML2Python.py.

16  def __len__ (self):
17  # treat single element as a list of 1
18  return 1
19 

◆ __nonzero__()

def python.XML2Python.DataNode.__nonzero__ (   self)

◆ __repr__()

def python.XML2Python.DataNode.__repr__ (   self)

◆ __str__()

def python.XML2Python.DataNode.__str__ (   self)

◆ _add_xml_attr()

def python.XML2Python.DataNode._add_xml_attr (   self,
  name,
  value 
)
private

Definition at line 38 of file XML2Python.py.

References python.XML2Python.DataNode._attrs, XML2Python.DataNode._attrs, python.XML2Python.DataNode._ncDict, XML2Python.DataNode._ncDict, and XML2Python.TreeBuilder._ncDict.

38  def _add_xml_attr (self, name, value):
39  change = self._ncDict.get (name)
40  if change:
41  name = change
42  if name in self._attrs:
43  # multiple attribute of the same name are represented by a list
44  children = self._attrs[name]
45  if not isinstance(children, list):
46  children = [children]
47  self._attrs[name] = children
48  children.append(value)
49  else:
50  self._attrs[name] = value
51 

◆ attributes()

def python.XML2Python.DataNode.attributes (   self)

Definition at line 61 of file XML2Python.py.

References python.XML2Python.DataNode._attrs, and XML2Python.DataNode._attrs.

61  def attributes (self):
62  return self._attrs
63 
64 

Member Data Documentation

◆ _attrs

python.XML2Python.DataNode._attrs
private

◆ _data

python.XML2Python.DataNode._data
private

◆ _ncDict

python.XML2Python.DataNode._ncDict
private