fix weakref.KeyedRef and weakref.ref constructor type (#12803)

This commit is contained in:
Thomas Grainger
2024-10-14 09:07:53 +01:00
committed by GitHub
parent 1fa4986f71
commit cf9aa45d69

View File

@@ -54,8 +54,8 @@ class ProxyType(Generic[_T]): # "weakproxy"
def __getattr__(self, attr: str) -> Any: ...
class ReferenceType(Generic[_T]): # "weakref"
__callback__: Callable[[ReferenceType[_T]], Any]
def __new__(cls, o: _T, callback: Callable[[ReferenceType[_T]], Any] | None = ..., /) -> Self: ...
__callback__: Callable[[Self], Any]
def __new__(cls, o: _T, callback: Callable[[Self], Any] | None = ..., /) -> Self: ...
def __call__(self) -> _T | None: ...
def __eq__(self, value: object, /) -> bool: ...
def __hash__(self) -> int: ...
@@ -126,8 +126,8 @@ class WeakValueDictionary(MutableMapping[_KT, _VT]):
class KeyedRef(ref[_T], Generic[_KT, _T]):
key: _KT
def __new__(type, ob: _T, callback: Callable[[_T], Any], key: _KT) -> Self: ...
def __init__(self, ob: _T, callback: Callable[[_T], Any], key: _KT) -> None: ...
def __new__(type, ob: _T, callback: Callable[[Self], Any], key: _KT) -> Self: ...
def __init__(self, ob: _T, callback: Callable[[Self], Any], key: _KT) -> None: ...
class WeakKeyDictionary(MutableMapping[_KT, _VT]):
@overload