mirror of
https://github.com/python/cpython
synced 2024-10-14 11:03:18 +00:00
bpo-45359: Support TopologicalSorter type subscript (GH-28714)
* Support TopologicalSorter type subscript * 📜🤖 Added by blurb_it. * Add TopologicalSorter to GenericAlias tests * Update Misc/NEWS.d/next/Library/2021-10-03-22-27-35.bpo-45359.LX_uxe.rst Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com> Co-authored-by: Batuhan Taskaya <isidentical@gmail.com>
This commit is contained in:
parent
f893bb2e01
commit
3cb9731b7e
|
@ -1,3 +1,5 @@
|
||||||
|
from types import GenericAlias
|
||||||
|
|
||||||
__all__ = ["TopologicalSorter", "CycleError"]
|
__all__ = ["TopologicalSorter", "CycleError"]
|
||||||
|
|
||||||
_NODE_OUT = -1
|
_NODE_OUT = -1
|
||||||
|
@ -244,3 +246,5 @@ def static_order(self):
|
||||||
node_group = self.get_ready()
|
node_group = self.get_ready()
|
||||||
yield from node_group
|
yield from node_group
|
||||||
self.done(*node_group)
|
self.done(*node_group)
|
||||||
|
|
||||||
|
__class_getitem__ = classmethod(GenericAlias)
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
from contextvars import ContextVar, Token
|
from contextvars import ContextVar, Token
|
||||||
from dataclasses import Field
|
from dataclasses import Field
|
||||||
from functools import partial, partialmethod, cached_property
|
from functools import partial, partialmethod, cached_property
|
||||||
|
from graphlib import TopologicalSorter
|
||||||
from mailbox import Mailbox, _PartialFile
|
from mailbox import Mailbox, _PartialFile
|
||||||
try:
|
try:
|
||||||
import ctypes
|
import ctypes
|
||||||
|
@ -56,6 +57,7 @@ class BaseTest(unittest.TestCase):
|
||||||
OrderedDict, Counter, UserDict, UserList,
|
OrderedDict, Counter, UserDict, UserList,
|
||||||
Pattern, Match,
|
Pattern, Match,
|
||||||
partial, partialmethod, cached_property,
|
partial, partialmethod, cached_property,
|
||||||
|
TopologicalSorter,
|
||||||
AbstractContextManager, AbstractAsyncContextManager,
|
AbstractContextManager, AbstractAsyncContextManager,
|
||||||
Awaitable, Coroutine,
|
Awaitable, Coroutine,
|
||||||
AsyncIterable, AsyncIterator,
|
AsyncIterable, AsyncIterator,
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
Implement :pep:`585` for :class:`graphlib.TopologicalSorter`.
|
Loading…
Reference in a new issue