MCPcopy Index your code
hub / github.com/python/cpython / get_ready

Method get_ready

Lib/graphlib.py:112–136  ·  view source on GitHub ↗

Return a tuple of all the nodes that are ready. Initially it returns all nodes with no predecessors; once those are marked as processed by calling "done", further calls will return all new nodes that have all their predecessors already processed. Once no more progress can be

(self)

Source from the content-addressed store, hash-verified

110 raise CycleError("nodes are in a cycle", cycle)
111
112 def get_ready(self):
113 """Return a tuple of all the nodes that are ready.
114
115 Initially it returns all nodes with no predecessors; once those are marked
116 as processed by calling "done", further calls will return all new nodes that
117 have all their predecessors already processed. Once no more progress can be made,
118 empty tuples are returned.
119
120 Raises ValueError if called without calling "prepare" previously.
121 """
122 if self._ready_nodes is None:
123 raise ValueError("prepare() must be called first")
124
125 # Get the nodes that are ready and mark them
126 result = tuple(self._ready_nodes)
127 n2i = self._node2info
128 for node in result:
129 n2i[node].npredecessors = _NODE_OUT
130
131 # Clean the list of nodes that are ready and update
132 # the counter of nodes that we have returned.
133 self._ready_nodes.clear()
134 self._npassedout += len(result)
135
136 return result
137
138 def is_active(self):
139 """Return ``True`` if more progress can be made and ``False`` otherwise.

Callers 8

static_orderMethod · 0.95
test_doneMethod · 0.95
test_is_activeMethod · 0.95
get_groupsMethod · 0.80

Calls 1

clearMethod · 0.45

Tested by 7

test_doneMethod · 0.76
test_is_activeMethod · 0.76
get_groupsMethod · 0.64