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:
Nikita Sobolev 2023-11-11 02:23:27 +03:00 committed by GitHub
parent 06c47a305d
commit ae8116cfa9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 4 deletions

View file

@ -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', (