MCPcopy Create free account
hub / github.com/easy-graph/Easy-Graph / __call__

Method __call__

easygraph/readwrite/graphml.py:852–864  ·  view source on GitHub ↗
(self, path=None, string=None)

Source from the content-addressed store, hash-verified

850 self.edge_ids = {} # dict mapping (u,v) tuples to edge id attributes
851
852 def __call__(self, path=None, string=None):
853 from xml.etree.ElementTree import ElementTree
854 from xml.etree.ElementTree import fromstring
855
856 if path is not None:
857 self.xml = ElementTree(file=path)
858 elif string is not None:
859 self.xml = fromstring(string)
860 else:
861 raise ValueError("Must specify either 'path' or 'string' as kwarg")
862 (keys, defaults) = self.find_graphml_keys(self.xml)
863 for g in self.xml.findall(f"{{{self.NS_GRAPHML}}}graph"):
864 yield self.make_graph(g, keys, defaults)
865
866 def make_graph(self, graph_xml, graphml_keys, defaults, G=None):
867 # set default graph type

Callers

nothing calls this directly

Calls 2

find_graphml_keysMethod · 0.95
make_graphMethod · 0.95

Tested by

no test coverage detected