class_docstr: Provides functionality to topologically sort a graph of hashable nodes
docstr: Marks a set of nodes returned by "get_ready" as processed.
  
  This method unblocks any successor of each node in *nodes* for being returned
  in the future by a call to "get_ready".
  
  Raises :exec:`ValueError` if any node in *nodes* has already been marked as
  processed by a previous call to this method, if a node was not added to the
  graph by using "add" or if called without calling "prepare" previously or if
  node has not yet been returned by "get_ready".
docstr_tok: ["Marks","a","set","of","nodes","returned","by","``","get_ready","''","as","processed",".","This","method","unblocks","any","successor","of","each","node","in","*","nodes","*","for","being","returned","in","the","future","by","a","call","to","``","get_ready","''",".","Raises",":","exec",":","`","ValueError","`","if","any","node","in","*","nodes","*","has","already","been","marked","as","processed","by","a","previous","call","to","this","method",",","if","a","node","was","not","added","to","the","graph","by","using","``","add","''","or","if","called","without","calling","``","prepare","''","previously","or","if","node","has","not","yet","been","returned","by","``","get_ready","''","."]
code: def done(self, *nodes):
      """Marks a set of nodes returned by "get_ready" as processed.
  
      This method unblocks any successor of each node in *nodes* for being returned
      in the future by a call to "get_ready".
  
      Raises :exec:`ValueError` if any node in *nodes* has already been marked as
      processed by a previous call to this method, if a node was not added to the
      graph by using "add" or if called without calling "prepare" previously or if
      node has not yet been returned by "get_ready".
      """
  
      if self._ready_nodes is None:
          raise ValueError("prepare() must be called first")
  
      n2i = self._node2info
  
      for node in nodes:
          # Check if we know about this node (it was added previously using add()
          if (nodeinfo := n2i.get(node)) is None:
              raise ValueError(
                  f"node {node!r} was not added using add()"
              )
  
          # If the node has not being returned (marked as ready) previously, inform the user.
          stat = nodeinfo.npredecessors
          if stat != _NODE_OUT:
              if stat >= 0:
                  raise ValueError(
                      f"node {node!r} was not passed out (still not ready)"
                  )
              elif stat == _NODE_DONE:
                  raise ValueError(
                      f"node {node!r} was already marked done"
                  )
              else:
                  assert False, f"node {node!r}: unknown status {stat}"
  
          # Mark the node as processed
          nodeinfo.npredecessors = _NODE_DONE
  
          # Go to all the successors and reduce the number of predecessors, collecting all the ones
          # that are ready to be returned in the next get_ready() call.
          for successor in nodeinfo.successors:
              successor_info = n2i[successor]
              successor_info.npredecessors -= 1
              if successor_info.npredecessors == 0:
                  self._ready_nodes.append(successor)
          self._nfinished += 1
  
file_path: catboost/contrib/tools/python3/src/Lib/graphlib.py
imports: from types import GenericAlias
label_desc: Use image node_id 8 for calling the TopologicalSorter obj's underlying member method code with example usage: obj.done() without return types