|
def | __init__ (self, name) |
|
def | addSubDir (self, name) |
|
def | addHistogram (self, histogram, algorithm, annotations={}, output=DQHanConfMaker._default_output, attributes={}) |
|
def | getSubDir (self, name) |
|
def | tohan (self, encoding=None) |
|
def | toprettyhan (self, indent="\t", newl="\n", encoding=None) |
|
def | writehan (self, writer, indent="", addindent="", newl="") |
|
def | appendChild (self, child) |
|
def | setAttribute (self, key, attribute) |
|
def | removeAttribute (self, key) |
|
def | getAttribute (self, key) |
|
def | getSubNode (self, name, nodetype) |
|
def | __str__ (self) |
|
Class representing a dir element
A han dir element is a Node with sub nodes of type HanDir or HanHisto
Definition at line 383 of file hanwriter.py.
◆ __init__()
def python.hanwriter.HanDir.__init__ |
( |
|
self, |
|
|
|
name |
|
) |
| |
◆ __str__()
def python.hanwriter.Node.__str__ |
( |
|
self | ) |
|
|
inherited |
Definition at line 191 of file hanwriter.py.
192 return "HanNode: "+self.name+
" ("+DQHanConfMaker._get_NodeType(self.nodeType)+
") Attributes:"+
str(self.attributes)+
" SubNodes: "+
str(self.subnodes)
◆ addHistogram()
def python.hanwriter.HanDir.addHistogram |
( |
|
self, |
|
|
|
histogram, |
|
|
|
algorithm, |
|
|
|
annotations = {} , |
|
|
|
output = DQHanConfMaker._default_output , |
|
|
|
attributes = {} |
|
) |
| |
Adds to the directory a histogram specifying the histogram name, the algorithm and the output path.
Definition at line 417 of file hanwriter.py.
417 def addHistogram(self, histogram, algorithm, annotations={}, output=DQHanConfMaker._default_output, attributes={}):
419 Adds to the directory a histogram specifying the histogram name, the algorithm and the output path.
421 histo = HanHistogram(histogram, algorithm,
422 annotations, output, attributes)
423 self.appendChild(histo)
◆ addSubDir()
def python.hanwriter.HanDir.addSubDir |
( |
|
self, |
|
|
|
name |
|
) |
| |
Adds a subdirectory called name to the current directory and returns the newly created sub directory
Definition at line 402 of file hanwriter.py.
402 def addSubDir(self, name):
404 Adds a subdirectory called name to the current directory and returns the newly created sub directory
406 subdir = HanDir(name)
407 self.appendChild(subdir)
◆ appendChild()
def python.hanwriter.Node.appendChild |
( |
|
self, |
|
|
|
child |
|
) |
| |
|
inherited |
Add a sub node to this node
Definition at line 127 of file hanwriter.py.
127 def appendChild(self, child):
129 Add a sub node to this node
132 if child.nodeType
not in self.acceptChild:
133 msg =
" Node: "+DQHanConfMaker._get_NodeType(self.nodeType)
134 msg +=
" Cannot have a child of type:", child.nodeType
135 raise HanCannotCreateConf(msg)
137 raise HanCannotCreateConf(
138 "Object:"+
str(child)+
" is not a valid Node")
139 if not self.subnodes:
141 self.subnodes += [child]
◆ getAttribute()
def python.hanwriter.Node.getAttribute |
( |
|
self, |
|
|
|
key |
|
) |
| |
|
inherited |
Gets the attribute identified by the key, None if not found
Definition at line 169 of file hanwriter.py.
169 def getAttribute(self, key):
171 Gets the attribute identified by the key, None if not found
173 if self.attributes
and key
in self.attributes:
174 return self.attributes[key]
◆ getSubDir()
def python.hanwriter.HanDir.getSubDir |
( |
|
self, |
|
|
|
name |
|
) |
| |
returns the sub-directory called name
Definition at line 428 of file hanwriter.py.
428 def getSubDir(self, name):
430 returns the sub-directory called name
432 return self.getSubNode(name, Node.DIR)
◆ getSubNode()
def python.hanwriter.Node.getSubNode |
( |
|
self, |
|
|
|
name, |
|
|
|
nodetype |
|
) |
| |
|
inherited |
Returns the sub-node identified by name and nodetype
Definition at line 181 of file hanwriter.py.
181 def getSubNode(self, name, nodetype):
183 Returns the sub-node identified by name and nodetype
186 for sn
in self.subnodes:
187 if sn.nodeType == nodetype
and sn.name == name:
◆ removeAttribute()
def python.hanwriter.Node.removeAttribute |
( |
|
self, |
|
|
|
key |
|
) |
| |
|
inherited |
Removes attribute identified by key
Definition at line 157 of file hanwriter.py.
157 def removeAttribute(self, key):
159 Removes attribute identified by key
161 if self.attributes
and key
in self.attributes:
162 del self.attributes[key]
◆ setAttribute()
def python.hanwriter.Node.setAttribute |
( |
|
self, |
|
|
|
key, |
|
|
|
attribute |
|
) |
| |
|
inherited |
The attribute identified by key is added to this node
Definition at line 146 of file hanwriter.py.
146 def setAttribute(self, key, attribute):
148 The attribute identified by key is added to this node
150 if not self.attributes:
152 self.attributes[key] = attribute
◆ tohan()
def python.hanwriter.Node.tohan |
( |
|
self, |
|
|
|
encoding = None |
|
) |
| |
|
inherited |
convert the object in a valid han script block
Definition at line 75 of file hanwriter.py.
75 def tohan(self, encoding=None):
77 convert the object in a valid han script block
79 return self.toprettyhan(
"",
"", encoding)
◆ toprettyhan()
def python.hanwriter.Node.toprettyhan |
( |
|
self, |
|
|
|
indent = "\t" , |
|
|
|
newl = "\n" , |
|
|
|
encoding = None |
|
) |
| |
|
inherited |
convert the object in a formatted han string
Definition at line 86 of file hanwriter.py.
86 def toprettyhan(self, indent="\t", newl="\n", encoding=None):
88 convert the object in a formatted han string
94 writer = io.BytesIO()
if six.PY2
else io.StringIO()
95 if encoding
is not None:
97 writer = codecs.lookup(encoding)[3](writer)
98 self.writehan(writer,
"", indent, newl)
99 return writer.getvalue()
◆ writehan()
def python.hanwriter.Node.writehan |
( |
|
self, |
|
|
|
writer, |
|
|
|
indent = "" , |
|
|
|
addindent = "" , |
|
|
|
newl = "" |
|
) |
| |
|
inherited |
Converts the object in a han string and writes it in the writer object
Definition at line 106 of file hanwriter.py.
106 def writehan(self, writer, indent="", addindent="", newl=""):
108 Converts the object in a han string and writes it in the writer object
111 indent+DQHanConfMaker._get_NodeType(self.nodeType)+
" "+self.name)
113 if self.nodeType != Node.DOCUMENT:
114 writer.write(
" { %s" % (newl))
116 for key, attribute
in self.attributes.
items():
117 writer.write(
"%s %s = %s%s" % (indent, key, attribute, newl))
119 for node
in self.subnodes:
120 node.writehan(writer, indent+addindent, addindent, newl)
121 if self.nodeType != Node.DOCUMENT:
122 writer.write(
"%s}%s" % (indent, newl))
◆ acceptChild
python.hanwriter.HanDir.acceptChild |
◆ attributes
python.hanwriter.Node.attributes |
|
inherited |
◆ name
python.hanwriter.Node.name |
|
inherited |
◆ nodeType
python.hanwriter.HanDir.nodeType |
◆ subnodes
python.hanwriter.Node.subnodes |
|
inherited |
The documentation for this class was generated from the following file: