mirror of
https://github.com/python/cpython.git
synced 2025-08-04 17:08:35 +00:00
gh-107431: Make multiprocessing.managers.{DictProxy,ListProxy}
generic (#107433)
Make `multiprocessing.managers.{DictProxy,ListProxy}` generic for type annotation use. `ListProxy[str]` for example. Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com> Co-authored-by: Gregory P. Smith <greg@krypto.org>
This commit is contained in:
parent
06c47a305d
commit
ae8116cfa9
3 changed files with 12 additions and 4 deletions
|
@ -1165,15 +1165,19 @@ class ListProxy(BaseListProxy):
|
|||
self._callmethod('__imul__', (value,))
|
||||
return self
|
||||
|
||||
__class_getitem__ = classmethod(types.GenericAlias)
|
||||
|
||||
DictProxy = MakeProxyType('DictProxy', (
|
||||
|
||||
_BaseDictProxy = MakeProxyType('DictProxy', (
|
||||
'__contains__', '__delitem__', '__getitem__', '__iter__', '__len__',
|
||||
'__setitem__', 'clear', 'copy', 'get', 'items',
|
||||
'keys', 'pop', 'popitem', 'setdefault', 'update', 'values'
|
||||
))
|
||||
DictProxy._method_to_typeid_ = {
|
||||
_BaseDictProxy._method_to_typeid_ = {
|
||||
'__iter__': 'Iterator',
|
||||
}
|
||||
class DictProxy(_BaseDictProxy):
|
||||
__class_getitem__ = classmethod(types.GenericAlias)
|
||||
|
||||
|
||||
ArrayProxy = MakeProxyType('ArrayProxy', (
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue