File: graphlib.pyi

package info (click to toggle)
typeshed 0.0~git20241223.ea91db2-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 28,756 kB
  • sloc: python: 7,741; makefile: 20; sh: 18
file content (28 lines) | stat: -rw-r--r-- 917 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import sys
from _typeshed import SupportsItems
from collections.abc import Iterable
from typing import Any, Generic, TypeVar, overload

__all__ = ["TopologicalSorter", "CycleError"]

_T = TypeVar("_T")

if sys.version_info >= (3, 11):
    from types import GenericAlias

class TopologicalSorter(Generic[_T]):
    @overload
    def __init__(self, graph: None = None) -> None: ...
    @overload
    def __init__(self, graph: SupportsItems[_T, Iterable[_T]]) -> None: ...
    def add(self, node: _T, *predecessors: _T) -> None: ...
    def prepare(self) -> None: ...
    def is_active(self) -> bool: ...
    def __bool__(self) -> bool: ...
    def done(self, *nodes: _T) -> None: ...
    def get_ready(self) -> tuple[_T, ...]: ...
    def static_order(self) -> Iterable[_T]: ...
    if sys.version_info >= (3, 11):
        def __class_getitem__(cls, item: Any, /) -> GenericAlias: ...

class CycleError(ValueError): ...