本文整理汇总了Python中treelib.Tree.__init__方法的典型用法代码示例。如果您正苦于以下问题:Python Tree.__init__方法的具体用法?Python Tree.__init__怎么用?Python Tree.__init__使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类treelib.Tree
的用法示例。
在下文中一共展示了Tree.__init__方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from treelib import Tree [as 别名]
# 或者: from treelib.Tree import __init__ [as 别名]
def __init__(self, id, opcode, op_array, context):
""" Create a tree representaiton of an Opcode
Arguments :
id : The id representing the new OPcode
opcode : An OPcode struct
op_array : The op_array of the OPcode
context : An OPcacheParser instance
"""
Tree.__init__(self)
# Identifier to be used by the tree and nodes
id_with_hash = str(hash(str(op_array))) + "_" + id
# OP name
op = OPcodeParser.get_opcode_name(opcode['opcode'])
# Parser
context = OPcodeParser(context)
# Parse operands and result
(op1, op2, result) = context.parse_operands(opcode, op_array)
# Create nodes
op1_node = Node("Operand 1: " + op1, id_with_hash + "_op1")
op2_node = Node("Operand 2: " + op2, id_with_hash + "_op2")
result_node = Node("Result: " + result, id_with_hash + "_result")
# Link nodes to tree
self.create_node(id + ": " + op, id_with_hash + "_opcode")
self.add_node(op1_node, parent=id_with_hash + "_opcode")
self.add_node(op2_node, parent=id_with_hash + "_opcode")
self.add_node(result_node, parent=id_with_hash + "_opcode")
示例2: __init__
# 需要导入模块: from treelib import Tree [as 别名]
# 或者: from treelib.Tree import __init__ [as 别名]
def __init__(self,
srcstring):
"""
RHypothesesTree.__init__
================================================================
PARAMETERS :
o srcstring_slice :
a list of two positive or null integers like (1,4).
"""
TLTree.__init__(self)
self.srcstring = srcstring
self.srcstring_slice = [0, len(self.srcstring)-1 ]
# root node :
self.create_node(tag = "root",
data = RHypothesisData(x0_a = 0,
x0_b = 0,
substring_a = self.srcstring,
substring_b = self.srcstring))
示例3: __init__
# 需要导入模块: from treelib import Tree [as 别名]
# 或者: from treelib.Tree import __init__ [as 别名]
def __init__(self, tree=None):
Tree.__init__(self, tree)
示例4: __init__
# 需要导入模块: from treelib import Tree [as 别名]
# 或者: from treelib.Tree import __init__ [as 别名]
def __init__(self):
Tree.__init__(self)