From 7ed8da4415438c62f5b85dca8de5ebeaa0a36b86 Mon Sep 17 00:00:00 2001 From: Akuli Date: Mon, 20 Sep 2021 00:04:23 +0300 Subject: [PATCH] Create stubs for toposort (#6048) --- pyrightconfig.stricter.json | 1 + stubs/toposort/METADATA.toml | 1 + stubs/toposort/toposort.pyi | 10 ++++++++++ 3 files changed, 12 insertions(+) create mode 100644 stubs/toposort/METADATA.toml create mode 100644 stubs/toposort/toposort.pyi diff --git a/pyrightconfig.stricter.json b/pyrightconfig.stricter.json index daa4a641b..0c9ef86ee 100644 --- a/pyrightconfig.stricter.json +++ b/pyrightconfig.stricter.json @@ -60,6 +60,7 @@ "stubs/simplejson", "stubs/slumber", "stubs/stripe", + "stubs/toposort", "stubs/ttkthemes", "stubs/vobject", "stubs/waitress", diff --git a/stubs/toposort/METADATA.toml b/stubs/toposort/METADATA.toml new file mode 100644 index 000000000..83bb457df --- /dev/null +++ b/stubs/toposort/METADATA.toml @@ -0,0 +1 @@ +version = "1.6" diff --git a/stubs/toposort/toposort.pyi b/stubs/toposort/toposort.pyi new file mode 100644 index 000000000..9410d8279 --- /dev/null +++ b/stubs/toposort/toposort.pyi @@ -0,0 +1,10 @@ +from typing import Any, Iterator, TypeVar + +_T = TypeVar("_T") + +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]: ...