コード例 #1
0
 def test_xml_hypergraph(self):
     gr = testlib.new_hypergraph()
     dotstr = markup.write(gr)
     gr1 = markup.read(dotstr)
     dotstr = markup.write(gr1)
     gr2 = markup.read(dotstr)
     graph_equality(gr1, gr2)
コード例 #2
0
 def test_xml_hypergraph(self):
     gr = testlib.new_hypergraph()
     dotstr = markup.write(gr)
     gr1 = markup.read(dotstr)
     dotstr = markup.write(gr1)
     gr2 = markup.read(dotstr)  
     graph_equality(gr1, gr2)
コード例 #3
0
 def test_dot_for_digraph(self):
     gr = testlib.new_digraph()
     dotstr = markup.write(gr)
     gr1 = markup.read(dotstr)
     dotstr = markup.write(gr1)
     gr2 = markup.read(dotstr)  
     graph_equality(gr1, gr2)
コード例 #4
0
 def test_xml_digraph(self):
     gr = testlib.new_digraph()
     dotstr = markup.write(gr)
     gr1 = markup.read(dotstr)
     dotstr = markup.write(gr1)
     gr2 = markup.read(dotstr)
     graph_equality(gr1, gr2)
     assert len(gr.nodes()) == len(gr1.nodes())
     assert len(gr.edges()) == len(gr1.edges())
コード例 #5
0
 def test_xml_digraph(self):
     gr = testlib.new_digraph()
     dotstr = markup.write(gr)
     gr1 = markup.read(dotstr)
     dotstr = markup.write(gr1)
     gr2 = markup.read(dotstr)  
     graph_equality(gr1, gr2)
     assert len(gr.nodes()) == len(gr1.nodes())
     assert len(gr.edges()) == len(gr1.edges())
コード例 #6
0
def seqmake(db, config, ism_args):
    """
    Parse the CLI arguments and invoke the 'seqmake' function.
    """
    (ism_options, action_args) = _parse(config, ism_args)

    _LOGGER.debug("Reading from: %s", ism_options.src)
    src = ism_options.src
    if src == '-':
        src = sys.stdin
    else:
        src = open(src, "r")

    xml = src.read()
    depgraph = read(xml)

    (ise_model, xml_result, error) = makesequence(depgraph, ism_options.algo)
    if error is not None:
        # Issue a warning here (and not error) since the only thing
        # really required is the availability of the xml_result
        _LOGGER.warning(str(error))

    dst = ism_options.out
    _LOGGER.debug("Writing to: %s", dst)

    output = ET.tostring(xml_result, pretty_print=True, encoding="UTF-8")
    if dst == '-':
        _LOGGER.output(output)
    else:
        print(output, file=open(dst, "w"))

    return EX_OK
コード例 #7
0
def main_fun(xmlgraphfile):

    with open(xmlgraphfile) as f:
        grstr = f.read()

    gr = xmlwriter.read(grstr)
    write(gr,sys.stdout)
コード例 #8
0
ファイル: parser.py プロジェクト: jakubmozaryn/cog-abm
    def parse_graph(self, source):
        """
        Parse graph when given as pygraph in xml.

        @type source: String
        @param source: XML document for pygraph directory.

        @rtype: pygraph
        @return: Returns graph from pygraph library.
        """
        if source is None:
            return None
        with open(source, 'r') as file:
            return Network(markup.read(file.read()))
コード例 #9
0
ファイル: parser.py プロジェクト: kkonrad/cog-abm
	def parse_graph(self, source):
		"""
		Parse graph when given as pygraph in xml.
		
		@type source: String
		@param source: XML document for pygraph directory.
		
		@rtype: pygraph
		@return: Returns graph from pygraph library.
		"""
		if source is None:
			return None
		with open(source, 'r') as file:
			return Network(markup.read(file.read()))