functools: add TopologicalSorter for py39 (#4068)

* functools: add TopologicalSorter for py39

* fix flake8 error

Co-authored-by: hauntsaninja <>
This commit is contained in:
Shantanu
2020-05-24 18:44:28 -07:00
committed by GitHub
parent e560ce0f57
commit 8f6fd0e05a

View File

@@ -97,3 +97,15 @@ if sys.version_info >= (3, 8):
@overload
def __get__(self, instance: _S, owner: Optional[Type[Any]] = ...) -> _T: ...
def __set_name__(self, owner: Type[Any], name: str) -> None: ...
if sys.version_info >= (3, 9):
class TopologicalSorter(Generic[_T]):
def __init__(self, graph: Optional[Dict[_T, Iterable[_T]]] = ...) -> None: ...
def add(self, node: _T, *predecessors: _T) -> None: ...
def prepare(self) -> None: ...
def is_active(self) -> bool: ...
def done(self, *nodes: _T) -> None: ...
def get_ready(self) -> Tuple[_T, ...]: ...
def static_order(self) -> Iterable[_T]: ...
class CycleError(ValueError): ...