mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-07 20:54:28 +08:00
Continuing work towards #8988. The first five commits were created using stubdefaulter on various Python versions; the following commits were all created manually by me to fix various problems. The main things this adds that weren't present in #9501 are: - Defaults in Windows-only modules and Windows-only branches (because I'm running a Windows machine) - Defaults in non-py311 branches - Defaults for float parameters - Defaults for overloads
29 lines
914 B
Python
29 lines
914 B
Python
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): ...
|