|
def | __init__ (self, top_level_algorithm='WorstCaseSummary') |
|
def | addOutput (self, name, algorithm, annotations={}, attributes={}) |
|
def | getAlgorithm (self, name) |
|
def | getReference (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) |
|
def | getAlgorithm (self) |
|
def | getOutputPath (self, append=None, delimiter="/") |
|
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 han document
Definition at line 510 of file hanwriter.py.
◆ __init__()
def python.hanwriter.Document.__init__ |
( |
|
self, |
|
|
|
top_level_algorithm = 'WorstCaseSummary' |
|
) |
| |
Creates an empty han document with a top level output
Reimplemented from python.hanwriter.HanDir.
Definition at line 517 of file hanwriter.py.
517 def __init__(self, top_level_algorithm='WorstCaseSummary'):
519 Creates an empty han document with a top level output
521 HanDir.__init__(self,
'')
522 HanOutput.__init__(self,
'')
523 self.nodeType = Node.DOCUMENT
524 self.acceptChild = [Node.ALGORITHM, Node.DIR, Node.HIST, Node.OUTPUT, Node.REFERENCE, Node.THRESHOLD,
526 self.root_output_level = HanOutput(
'top_level', top_level_algorithm)
527 self.appendChild(self.root_output_level)
◆ __str__() [1/2]
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)
◆ __str__() [2/2]
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 = {} |
|
) |
| |
|
inherited |
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)
◆ addOutput()
def python.hanwriter.Document.addOutput |
( |
|
self, |
|
|
|
name, |
|
|
|
algorithm, |
|
|
|
annotations = {} , |
|
|
|
attributes = {} |
|
) |
| |
Adds a sub output element with name and algorithm
Reimplemented from python.hanwriter.HanOutput.
Definition at line 535 of file hanwriter.py.
535 def addOutput(self, name, algorithm, annotations={}, attributes={}):
537 Adds a sub output element with name and algorithm
540 return HanOutput.addOutput(self.root_output_level, name, algorithm, annotations, attributes)
◆ addSubDir()
def python.hanwriter.HanDir.addSubDir |
( |
|
self, |
|
|
|
name |
|
) |
| |
|
inherited |
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() [1/2]
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]
◆ appendChild() [2/2]
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]
◆ getAlgorithm() [1/2]
def python.hanwriter.HanOutput.getAlgorithm |
( |
|
self | ) |
|
|
inherited |
Gets the algorithm attribute
Definition at line 469 of file hanwriter.py.
469 def getAlgorithm(self):
471 Gets the algorithm attribute
473 if 'algorithm' in self.attributes:
474 return self.getAttribute(
'algorithm')
◆ getAlgorithm() [2/2]
def python.hanwriter.Document.getAlgorithm |
( |
|
self, |
|
|
|
name |
|
) |
| |
retrieves the algorithm han object associated with name
Definition at line 545 of file hanwriter.py.
545 def getAlgorithm(self, name):
547 retrieves the algorithm han object associated with name
549 return self.getSubNode(name, Node.ALGORITHM)
◆ getAttribute() [1/2]
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]
◆ getAttribute() [2/2]
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]
◆ getOutputPath()
def python.hanwriter.HanOutput.getOutputPath |
( |
|
self, |
|
|
|
append = None , |
|
|
|
delimiter = "/" |
|
) |
| |
|
inherited |
Creates the complete path of this output directory
Definition at line 494 of file hanwriter.py.
494 def getOutputPath(self, append=None, delimiter="/"):
496 Creates the complete path of this output directory
502 name = self.father.getOutputPath(delimiter+name, delimiter)
◆ getReference()
def python.hanwriter.Document.getReference |
( |
|
self, |
|
|
|
name |
|
) |
| |
retrieves the han reference associated with name
Definition at line 554 of file hanwriter.py.
554 def getReference(self, name):
556 retrieves the han reference associated with name
558 return self.getSubNode(name, Node.REFERENCE)
◆ getSubDir()
def python.hanwriter.HanDir.getSubDir |
( |
|
self, |
|
|
|
name |
|
) |
| |
|
inherited |
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() [1/2]
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:
◆ getSubNode() [2/2]
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() [1/2]
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]
◆ removeAttribute() [2/2]
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() [1/2]
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
◆ setAttribute() [2/2]
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() [1/2]
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)
◆ tohan() [2/2]
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() [1/2]
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()
◆ toprettyhan() [2/2]
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() [1/2]
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))
◆ writehan() [2/2]
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.Document.acceptChild |
◆ attributes [1/2]
python.hanwriter.Node.attributes |
|
inherited |
◆ attributes [2/2]
python.hanwriter.Node.attributes |
|
inherited |
◆ father
python.hanwriter.HanOutput.father |
|
inherited |
◆ name [1/2]
python.hanwriter.Node.name |
|
inherited |
◆ name [2/2]
python.hanwriter.Node.name |
|
inherited |
◆ nodeType
python.hanwriter.Document.nodeType |
◆ root_output_level
python.hanwriter.Document.root_output_level |
◆ subnodes [1/2]
python.hanwriter.Node.subnodes |
|
inherited |
◆ subnodes [2/2]
python.hanwriter.Node.subnodes |
|
inherited |
The documentation for this class was generated from the following file: