toposort: Make argument types less restrictive (#6531)

This commit is contained in:
Akuli
2021-12-07 17:26:09 +02:00
committed by GitHub
parent f31b49699a
commit 91465a1d07
2 changed files with 11 additions and 4 deletions

View File

@@ -1 +1 @@
version = "1.6.*"
version = "1.7"

View File

@@ -1,10 +1,17 @@
from typing import Any, Iterator, TypeVar
from _typeshed import SupportsItems
from typing import Any, Iterable, Iterator, TypeVar
from typing_extensions import Protocol
_KT_co = TypeVar("_KT_co", covariant=True)
_VT_co = TypeVar("_VT_co", covariant=True)
_T = TypeVar("_T")
class _SupportsItemsAndLen(SupportsItems[_KT_co, _VT_co], Protocol[_KT_co, _VT_co]):
def __len__(self) -> int: ...
class CircularDependencyError(ValueError):
data: dict[Any, set[Any]]
def __init__(self, data: dict[Any, set[Any]]) -> None: ...
def toposort(data: dict[_T, set[_T]]) -> Iterator[set[_T]]: ...
def toposort_flatten(data: dict[_T, set[_T]], sort: bool = ...) -> list[_T]: ...
def toposort(data: _SupportsItemsAndLen[_T, Iterable[_T]]) -> Iterator[set[_T]]: ...
def toposort_flatten(data: _SupportsItemsAndLen[_T, Iterable[_T]], sort: bool = ...) -> list[_T]: ...