|  | 
| def | __init__ (self, name, algoname, libname='libdqm_algorithms.so', reference=None, thresholds=None, parameters={}) | 
|  | 
| 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 DQAlgorithm
 
Definition at line 245 of file hanwriter.py.
◆ __init__()
      
        
          | def python.hanwriter.HanAlgorithm.__init__ | ( |  | self, | 
        
          |  |  |  | name, | 
        
          |  |  |  | algoname, | 
        
          |  |  |  | libname = 'libdqm_algorithms.so', | 
        
          |  |  |  | reference = None, | 
        
          |  |  |  | thresholds = None, | 
        
          |  |  |  | parameters = {} | 
        
          |  | ) |  |  | 
      
 
Creates a han algorithm configuration element
 
Definition at line 257 of file hanwriter.py.
  257     def __init__(self, name, algoname, libname='libdqm_algorithms.so', reference=None, thresholds=None,
 
  260         Creates a han algorithm configuration element 
  262         Node.__init__(self, name)
 
  263         self.acceptChild = [Node.THRESHOLD, Node.REFERENCE]
 
  264         self.nodeType = Node.ALGORITHM
 
  265         self.setAttribute(
'name', algoname)
 
  267             self.setAttribute(
'libname', libname)
 
  269             self.setAttribute(
'reference', reference)
 
  271             self.setAttribute(
'thresholds', thresholds)
 
  272         for parameter 
in parameters:
 
  273             self.setAttribute(parameter, parameters[parameter])
 
 
 
◆ __str__()
  
  | 
        
          | def python.hanwriter.Node.__str__ | ( |  | self | ) |  |  | inherited | 
 
Definition at line 190 of file hanwriter.py.
  191         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 126 of file hanwriter.py.
  126     def appendChild(self, child):
 
  128         Add a sub node to this node 
  131             if child.nodeType 
not in self.acceptChild:
 
  132                 msg = 
" Node: "+DQHanConfMaker._get_NodeType(self.nodeType)
 
  133                 msg += 
" Cannot have a child of type:", child.nodeType
 
  134                 raise HanCannotCreateConf(msg)
 
  136             raise HanCannotCreateConf(
 
  137                 "Object:"+
str(child)+
" is not a valid Node")
 
  138         if not self.subnodes:
 
  140         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 168 of file hanwriter.py.
  168     def getAttribute(self, key):
 
  170         Gets the attribute identified by the key, None if not found 
  172         if self.attributes 
and key 
in self.attributes:
 
  173             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 180 of file hanwriter.py.
  180     def getSubNode(self, name, nodetype):
 
  182         Returns the sub-node identified by name and nodetype 
  185             for sn 
in self.subnodes:
 
  186                 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 156 of file hanwriter.py.
  156     def removeAttribute(self, key):
 
  158         Removes attribute identified by key 
  160         if self.attributes 
and key 
in self.attributes:
 
  161             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 145 of file hanwriter.py.
  145     def setAttribute(self, key, attribute):
 
  147         The attribute identified by key is added to this node 
  149         if not self.attributes:
 
  151         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 
   93         writer = io.StringIO()
 
   94         if encoding 
is not None:
 
   96             writer = codecs.lookup(encoding)[3](writer)
 
   97         self.writehan(writer, 
"", indent, newl)
 
   98         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 105 of file hanwriter.py.
  105     def writehan(self, writer, indent="", addindent="", newl=""):
 
  107         Converts the object in a han string and writes it in the writer object 
  110             indent+DQHanConfMaker._get_NodeType(self.nodeType)+
" "+self.name)
 
  112         if self.nodeType != Node.DOCUMENT:
 
  113             writer.write(
" { %s" % (newl))
 
  115             for key, attribute 
in self.attributes.
items():
 
  116                 writer.write(
"%s %s = %s%s" % (indent, key, attribute, newl))
 
  118             for node 
in self.subnodes:
 
  119                 node.writehan(writer, indent+addindent, addindent, newl)
 
  120         if self.nodeType != Node.DOCUMENT:
 
  121             writer.write(
"%s}%s" % (indent, newl))
 
 
 
◆ acceptChild
      
        
          | python.hanwriter.HanAlgorithm.acceptChild | 
      
 
 
◆ attributes
  
  | 
        
          | python.hanwriter.Node.attributes |  | inherited | 
 
 
◆ name
  
  | 
        
          | python.hanwriter.Node.name |  | inherited | 
 
 
◆ nodeType
      
        
          | python.hanwriter.HanAlgorithm.nodeType | 
      
 
 
◆ subnodes
  
  | 
        
          | python.hanwriter.Node.subnodes |  | inherited | 
 
 
The documentation for this class was generated from the following file: