|
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 511 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 518 of file hanwriter.py.
518 def __init__(self, top_level_algorithm='WorstCaseSummary'):
520 Creates an empty han document with a top level output
522 HanDir.__init__(self,
'')
523 HanOutput.__init__(self,
'')
524 self.nodeType = Node.DOCUMENT
525 self.acceptChild = [Node.ALGORITHM, Node.DIR, Node.HIST, Node.OUTPUT, Node.REFERENCE, Node.THRESHOLD,
527 self.root_output_level = HanOutput(
'top_level', top_level_algorithm)
528 self.appendChild(self.root_output_level)
◆ __str__() [1/2]
def python.hanwriter.Node.__str__ |
( |
|
self | ) |
|
|
inherited |
Definition at line 192 of file hanwriter.py.
193 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 192 of file hanwriter.py.
193 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 418 of file hanwriter.py.
418 def addHistogram(self, histogram, algorithm, annotations={}, output=DQHanConfMaker._default_output, attributes={}):
420 Adds to the directory a histogram specifying the histogram name, the algorithm and the output path.
422 histo = HanHistogram(histogram, algorithm,
423 annotations, output, attributes)
424 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 536 of file hanwriter.py.
536 def addOutput(self, name, algorithm, annotations={}, attributes={}):
538 Adds a sub output element with name and algorithm
541 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 403 of file hanwriter.py.
403 def addSubDir(self, name):
405 Adds a subdirectory called name to the current directory and returns the newly created sub directory
407 subdir = HanDir(name)
408 self.appendChild(subdir)
◆ appendChild() [1/2]
def python.hanwriter.Node.appendChild |
( |
|
self, |
|
|
|
child |
|
) |
| |
|
inherited |
Add a sub node to this node
Definition at line 128 of file hanwriter.py.
128 def appendChild(self, child):
130 Add a sub node to this node
133 if child.nodeType
not in self.acceptChild:
134 msg =
" Node: "+DQHanConfMaker._get_NodeType(self.nodeType)
135 msg +=
" Cannot have a child of type:", child.nodeType
136 raise HanCannotCreateConf(msg)
138 raise HanCannotCreateConf(
139 "Object:"+
str(child)+
" is not a valid Node")
140 if not self.subnodes:
142 self.subnodes += [child]
◆ appendChild() [2/2]
def python.hanwriter.Node.appendChild |
( |
|
self, |
|
|
|
child |
|
) |
| |
|
inherited |
Add a sub node to this node
Definition at line 128 of file hanwriter.py.
128 def appendChild(self, child):
130 Add a sub node to this node
133 if child.nodeType
not in self.acceptChild:
134 msg =
" Node: "+DQHanConfMaker._get_NodeType(self.nodeType)
135 msg +=
" Cannot have a child of type:", child.nodeType
136 raise HanCannotCreateConf(msg)
138 raise HanCannotCreateConf(
139 "Object:"+
str(child)+
" is not a valid Node")
140 if not self.subnodes:
142 self.subnodes += [child]
◆ getAlgorithm() [1/2]
def python.hanwriter.HanOutput.getAlgorithm |
( |
|
self | ) |
|
|
inherited |
Gets the algorithm attribute
Definition at line 470 of file hanwriter.py.
470 def getAlgorithm(self):
472 Gets the algorithm attribute
474 if 'algorithm' in self.attributes:
475 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 546 of file hanwriter.py.
546 def getAlgorithm(self, name):
548 retrieves the algorithm han object associated with name
550 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 170 of file hanwriter.py.
170 def getAttribute(self, key):
172 Gets the attribute identified by the key, None if not found
174 if self.attributes
and key
in self.attributes:
175 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 170 of file hanwriter.py.
170 def getAttribute(self, key):
172 Gets the attribute identified by the key, None if not found
174 if self.attributes
and key
in self.attributes:
175 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 495 of file hanwriter.py.
495 def getOutputPath(self, append=None, delimiter="/"):
497 Creates the complete path of this output directory
503 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 555 of file hanwriter.py.
555 def getReference(self, name):
557 retrieves the han reference associated with name
559 return self.getSubNode(name, Node.REFERENCE)
◆ getSubDir()
def python.hanwriter.HanDir.getSubDir |
( |
|
self, |
|
|
|
name |
|
) |
| |
|
inherited |
returns the sub-directory called name
Definition at line 429 of file hanwriter.py.
429 def getSubDir(self, name):
431 returns the sub-directory called name
433 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 182 of file hanwriter.py.
182 def getSubNode(self, name, nodetype):
184 Returns the sub-node identified by name and nodetype
187 for sn
in self.subnodes:
188 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 182 of file hanwriter.py.
182 def getSubNode(self, name, nodetype):
184 Returns the sub-node identified by name and nodetype
187 for sn
in self.subnodes:
188 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 158 of file hanwriter.py.
158 def removeAttribute(self, key):
160 Removes attribute identified by key
162 if self.attributes
and key
in self.attributes:
163 del self.attributes[key]
◆ removeAttribute() [2/2]
def python.hanwriter.Node.removeAttribute |
( |
|
self, |
|
|
|
key |
|
) |
| |
|
inherited |
Removes attribute identified by key
Definition at line 158 of file hanwriter.py.
158 def removeAttribute(self, key):
160 Removes attribute identified by key
162 if self.attributes
and key
in self.attributes:
163 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 147 of file hanwriter.py.
147 def setAttribute(self, key, attribute):
149 The attribute identified by key is added to this node
151 if not self.attributes:
153 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 147 of file hanwriter.py.
147 def setAttribute(self, key, attribute):
149 The attribute identified by key is added to this node
151 if not self.attributes:
153 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 76 of file hanwriter.py.
76 def tohan(self, encoding=None):
78 convert the object in a valid han script block
80 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 76 of file hanwriter.py.
76 def tohan(self, encoding=None):
78 convert the object in a valid han script block
80 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 87 of file hanwriter.py.
87 def toprettyhan(self, indent="\t", newl="\n", encoding=None):
89 convert the object in a formatted han string
95 writer = io.BytesIO()
if six.PY2
else io.StringIO()
96 if encoding
is not None:
98 writer = codecs.lookup(encoding)[3](writer)
99 self.writehan(writer,
"", indent, newl)
100 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 87 of file hanwriter.py.
87 def toprettyhan(self, indent="\t", newl="\n", encoding=None):
89 convert the object in a formatted han string
95 writer = io.BytesIO()
if six.PY2
else io.StringIO()
96 if encoding
is not None:
98 writer = codecs.lookup(encoding)[3](writer)
99 self.writehan(writer,
"", indent, newl)
100 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 107 of file hanwriter.py.
107 def writehan(self, writer, indent="", addindent="", newl=""):
109 Converts the object in a han string and writes it in the writer object
112 indent+DQHanConfMaker._get_NodeType(self.nodeType)+
" "+self.name)
114 if self.nodeType != Node.DOCUMENT:
115 writer.write(
" { %s" % (newl))
117 for key, attribute
in self.attributes.
items():
118 writer.write(
"%s %s = %s%s" % (indent, key, attribute, newl))
120 for node
in self.subnodes:
121 node.writehan(writer, indent+addindent, addindent, newl)
122 if self.nodeType != Node.DOCUMENT:
123 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 107 of file hanwriter.py.
107 def writehan(self, writer, indent="", addindent="", newl=""):
109 Converts the object in a han string and writes it in the writer object
112 indent+DQHanConfMaker._get_NodeType(self.nodeType)+
" "+self.name)
114 if self.nodeType != Node.DOCUMENT:
115 writer.write(
" { %s" % (newl))
117 for key, attribute
in self.attributes.
items():
118 writer.write(
"%s %s = %s%s" % (indent, key, attribute, newl))
120 for node
in self.subnodes:
121 node.writehan(writer, indent+addindent, addindent, newl)
122 if self.nodeType != Node.DOCUMENT:
123 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: