Пример #1
0
    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")
    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")
Пример #3
0
 def __init__(self,
              tree=None,
              deep=False,
              node_class=None,
              identifier=None):
     Tree.__init__(self, tree, deep, node_class, identifier)
     pass
Пример #4
0
 def __init__(self, root=None, version=None, mode=None, outfile=None):
     # Retrieve original class init
     Tree.__init__(self)
     # Dataset and files record
     self.paths = dict()
     # Retrieve the root directory to build the DRS
     self.drs_root = root
     # Retrieve the dataset version to build the DRS
     self.drs_version = version
     # Retrieve the migration mode
     self.drs_mode = mode
     # Display width
     self.d_lengths = list()
     # Output file if submitted
     self.commands_file = outfile
     # List of duplicates to remove
     self.duplicates = list()
     # Dataset hash record
     self.hash = dict()
Пример #5
0
    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))
Пример #6
0
	def __init__(self, tree=None):
		Tree.__init__(self, tree)
Пример #7
0
 def __init__(self):
     Tree.__init__(self)
Пример #8
0
 def __init__(self):
     Tree.__init__(self)
     self.id_num = 0  # unique id
Пример #9
0
 def __init__(self):
     Tree.__init__(self)