def __init__( self, rr_graph_schema_fname, input_file_name, output_file_name=None, progressbar=None, build_pin_edges=True, rebase_nodes=True, filter_nodes=True, ): if progressbar is None: progressbar = lambda x: x # noqa: E731 self.input_file_name = input_file_name self.progressbar = progressbar self.output_file_name = output_file_name self.rr_graph_schema = capnp.load( rr_graph_schema_fname, imports=[os.path.dirname(os.path.dirname(capnp.__file__))]) graph_input = graph_from_capnp( rr_graph_schema=self.rr_graph_schema, input_file_name=input_file_name, progressbar=progressbar, filter_nodes=filter_nodes, rebase_nodes=rebase_nodes, ) graph_input['build_pin_edges'] = build_pin_edges self.root_attrib = graph_input["root_attrib"] del graph_input["root_attrib"] self.graph = graph2.Graph(**graph_input)
def __init__(self, input_xml, output_file_name=None, progressbar=None, build_pin_edges=True): if progressbar is None: progressbar = lambda x: x # noqa: E731 self.input_xml = input_xml self.progressbar = progressbar self.output_file_name = output_file_name graph_input = graph_from_xml(input_xml, progressbar) graph_input['build_pin_edges'] = build_pin_edges rebase_nodes = [] for node in graph_input['nodes']: node_d = node._asdict() node_d['id'] = len(rebase_nodes) rebase_nodes.append(graph2.Node(**node_d)) graph_input['nodes'] = rebase_nodes self.graph = graph2.Graph(**graph_input) self.exit_stack = None self.xf = None
def __init__(self, input_xml, progressbar=None): if progressbar is None: self.progressbar = lambda x: x self.input_xml = input_xml self.progressbar = progressbar graph_input = graph_from_xml(input_xml, progressbar) rebase_nodes = [] for node in progressbar(graph_input['nodes']): node_d = node._asdict() node_d['id'] = len(rebase_nodes) rebase_nodes.append(graph2.Node(**node_d)) graph_input['nodes'] = rebase_nodes self.graph = graph2.Graph(**graph_input)
def __init__( self, input_file_name, output_file_name=None, progressbar=None, build_pin_edges=True, rebase_nodes=True, filter_nodes=True, ): if progressbar is None: progressbar = lambda x: x # noqa: E731 self.input_file_name = input_file_name self.progressbar = progressbar self.output_file_name = output_file_name graph_input = graph_from_xml(input_file_name, progressbar, filter_nodes=filter_nodes) graph_input['build_pin_edges'] = build_pin_edges self.root_attrib = graph_input["root_attrib"] del graph_input["root_attrib"] if rebase_nodes: rebase_nodes = [] for node in graph_input['nodes']: node_d = node._asdict() node_d['id'] = len(rebase_nodes) rebase_nodes.append(graph2.Node(**node_d)) graph_input['nodes'] = rebase_nodes self.graph = graph2.Graph(**graph_input) self.xf = None self.xf_tag = [] if DEBUG > 0: self._write_xml = self._write_xml_debug else: self._write_xml = self._write_xml_no_debug