From 287647c9d7fd52c254b69be33c682fbca753ad0f Mon Sep 17 00:00:00 2001 From: Jacob Hayes Date: Sun, 3 Oct 2021 18:13:22 -0400 Subject: [PATCH 1/4] Support TopologicalSorter type subscript --- Lib/graphlib.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Lib/graphlib.py b/Lib/graphlib.py index 1c5d9a413c944d3..636545648e12d3b 100644 --- a/Lib/graphlib.py +++ b/Lib/graphlib.py @@ -1,3 +1,5 @@ +from types import GenericAlias + __all__ = ["TopologicalSorter", "CycleError"] _NODE_OUT = -1 @@ -244,3 +246,5 @@ def static_order(self): node_group = self.get_ready() yield from node_group self.done(*node_group) + + __class_getitem__ = classmethod(GenericAlias) From ef433513a9589a3058c8c1e60c3ac234df0c61ea Mon Sep 17 00:00:00 2001 From: "blurb-it[bot]" <43283697+blurb-it[bot]@users.noreply.github.com> Date: Sun, 3 Oct 2021 22:27:36 +0000 Subject: [PATCH 2/4] =?UTF-8?q?=F0=9F=93=9C=F0=9F=A4=96=20Added=20by=20blu?= =?UTF-8?q?rb=5Fit.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../NEWS.d/next/Library/2021-10-03-22-27-35.bpo-45359.LX_uxe.rst | 1 + 1 file changed, 1 insertion(+) create mode 100644 Misc/NEWS.d/next/Library/2021-10-03-22-27-35.bpo-45359.LX_uxe.rst diff --git a/Misc/NEWS.d/next/Library/2021-10-03-22-27-35.bpo-45359.LX_uxe.rst b/Misc/NEWS.d/next/Library/2021-10-03-22-27-35.bpo-45359.LX_uxe.rst new file mode 100644 index 000000000000000..6c976d166fab009 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2021-10-03-22-27-35.bpo-45359.LX_uxe.rst @@ -0,0 +1 @@ +Support :class:`graphlib.TopologicalSorter` type subscript \ No newline at end of file From 1322e9bd29eed72b15e2617205503971623f4ae4 Mon Sep 17 00:00:00 2001 From: Jacob Hayes Date: Tue, 19 Oct 2021 19:30:17 -0400 Subject: [PATCH 3/4] Add TopologicalSorter to GenericAlias tests --- Lib/test/test_genericalias.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Lib/test/test_genericalias.py b/Lib/test/test_genericalias.py index 0daaff099a868d7..706cc5ea1af2f0e 100644 --- a/Lib/test/test_genericalias.py +++ b/Lib/test/test_genericalias.py @@ -13,6 +13,7 @@ from contextvars import ContextVar, Token from dataclasses import Field from functools import partial, partialmethod, cached_property +from graphlib import TopologicalSorter from mailbox import Mailbox, _PartialFile try: import ctypes @@ -56,6 +57,7 @@ class BaseTest(unittest.TestCase): OrderedDict, Counter, UserDict, UserList, Pattern, Match, partial, partialmethod, cached_property, + TopologicalSorter, AbstractContextManager, AbstractAsyncContextManager, Awaitable, Coroutine, AsyncIterable, AsyncIterator, From 427b19095408303ec5bd324bab862ea4d4836f6c Mon Sep 17 00:00:00 2001 From: Batuhan Taskaya Date: Wed, 8 Dec 2021 19:05:53 +0300 Subject: [PATCH 4/4] Update Misc/NEWS.d/next/Library/2021-10-03-22-27-35.bpo-45359.LX_uxe.rst --- .../next/Library/2021-10-03-22-27-35.bpo-45359.LX_uxe.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Misc/NEWS.d/next/Library/2021-10-03-22-27-35.bpo-45359.LX_uxe.rst b/Misc/NEWS.d/next/Library/2021-10-03-22-27-35.bpo-45359.LX_uxe.rst index 6c976d166fab009..6f5c97fde82a071 100644 --- a/Misc/NEWS.d/next/Library/2021-10-03-22-27-35.bpo-45359.LX_uxe.rst +++ b/Misc/NEWS.d/next/Library/2021-10-03-22-27-35.bpo-45359.LX_uxe.rst @@ -1 +1 @@ -Support :class:`graphlib.TopologicalSorter` type subscript \ No newline at end of file +Implement :pep:`585` for :class:`graphlib.TopologicalSorter`. \ No newline at end of file