mirror of
https://github.com/python/cpython.git
synced 2025-10-09 16:34:44 +00:00
Issue #29011: Fix an important omission by adding Deque to the typing module.
This commit is contained in:
parent
a105dd3dc0
commit
80490525e0
4 changed files with 41 additions and 4 deletions
|
@ -59,6 +59,7 @@ __all__ = [
|
|||
'SupportsRound',
|
||||
|
||||
# Concrete collection types.
|
||||
'Deque',
|
||||
'Dict',
|
||||
'DefaultDict',
|
||||
'List',
|
||||
|
@ -1771,6 +1772,15 @@ class List(list, MutableSequence[T], extra=list):
|
|||
"use list() instead")
|
||||
return _generic_new(list, cls, *args, **kwds)
|
||||
|
||||
class Deque(collections.deque, MutableSequence[T], extra=collections.deque):
|
||||
|
||||
__slots__ = ()
|
||||
|
||||
def __new__(cls, *args, **kwds):
|
||||
if _geqv(cls, Deque):
|
||||
raise TypeError("Type Deque cannot be instantiated; "
|
||||
"use deque() instead")
|
||||
return _generic_new(collections.deque, cls, *args, **kwds)
|
||||
|
||||
class Set(set, MutableSet[T], extra=set):
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue