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

Method bunch_iter

easygraph/classes/directed_graph.py:382–399  ·  view source on GitHub ↗
(nlist, adj)

Source from the content-addressed store, hash-verified

380 else: # if nbunch is a sequence of nodes
381
382 def bunch_iter(nlist, adj):
383 try:
384 for n in nlist:
385 if n in adj:
386 yield n
387 except TypeError as err:
388 exc, message = err, err.args[0]
389 # capture error for non-sequence/iterator nbunch.
390 if "iter" in message:
391 exc = EasyGraphError(
392 "nbunch is not a node or a sequence of nodes."
393 )
394 # capture error for unhashable node.
395 if "hashable" in message:
396 exc = EasyGraphError(
397 f"Node {n} in sequence nbunch is not a valid node."
398 )
399 raise exc
400
401 bunch = bunch_iter(nbunch, self._adj)
402 return bunch

Callers

nothing calls this directly

Calls 1

EasyGraphErrorClass · 0.90

Tested by

no test coverage detected