from __future__ import annotations

from typing import *

T = TypeVar("T", bound=Hashable)

class CycleError(ValueError):
    pass

class TopologicalSorter(Generic[T]):
    def __init__(self) -> None: ...
    def get_ready(self) -> Iterable[T]: ...
    def add(self, node: T, predecessors: Tuple[T, ...]) -> None: ...
    def done(self, nodes: Tuple[T, ...]) -> None: ...
    def is_active(self) -> bool: ...
    def prepare(self) -> None: ...
    def copy(self) -> TopologicalSorter[T]: ...
