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

Method bunch_iter

easygraph/classes/graph.py:609–626  ·  view source on GitHub ↗
(nlist, adj)

Source from the content-addressed store, hash-verified

607 else: # if nbunch is a sequence of nodes
608
609 def bunch_iter(nlist, adj):
610 try:
611 for n in nlist:
612 if n in adj:
613 yield n
614 except TypeError as err:
615 exc, message = err, err.args[0]
616 # capture error for non-sequence/iterator nbunch.
617 if "iter" in message:
618 exc = EasyGraphError(
619 "nbunch is not a node or a sequence of nodes."
620 )
621 # capture error for unhashable node.
622 if "hashable" in message:
623 exc = EasyGraphError(
624 f"Node {n} in sequence nbunch is not a valid node."
625 )
626 raise exc
627
628 bunch = bunch_iter(nbunch, self._adj)
629 return bunch

Callers

nothing calls this directly

Calls 1

EasyGraphErrorClass · 0.90

Tested by

no test coverage detected