|
def | __init__ (self, name, warning, error) |
|
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) |
|
The han representation of a limit for a HanThreshold
Definition at line 328 of file hanwriter.py.
◆ __init__()
def python.hanwriter.HanLimit.__init__ |
( |
|
self, |
|
|
|
name, |
|
|
|
warning, |
|
|
|
error |
|
) |
| |
Creates a han limit object
Definition at line 337 of file hanwriter.py.
337 def __init__(self, name, warning, error):
339 Creates a han limit object
341 Node.__init__(self, name)
342 self.nodeType = Node.LIMIT
343 self.acceptChild = []
344 self.setAttribute(
'warning', warning)
345 self.setAttribute(
'error', error)
◆ __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)
◆ 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]
◆ 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.HanLimit.acceptChild |
◆ attributes
python.hanwriter.Node.attributes |
|
inherited |
◆ name
python.hanwriter.Node.name |
|
inherited |
◆ nodeType
python.hanwriter.HanLimit.nodeType |
◆ subnodes
python.hanwriter.Node.subnodes |
|
inherited |
The documentation for this class was generated from the following file: