mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-07 20:54:28 +08:00
Add missing __init__ for ReferenceType (#12125)
This commit is contained in:
@@ -540,7 +540,6 @@ wsgiref.handlers.BaseHandler.result
|
||||
wsgiref.handlers.BaseHandler.status
|
||||
|
||||
(_?weakref.ref|_?weakref.ReferenceType).__call__ # C function default annotation is wrong
|
||||
(_?weakref.ref|_?weakref.ReferenceType).__init__ # Runtime defines __new__ but stubtest thinks __init__ is also defined.
|
||||
_?weakref.CallableProxyType.__getattr__ # Should have all attributes of proxy
|
||||
_?weakref.ProxyType.__bytes__ # Doesn't actually exist
|
||||
_?weakref.ProxyType.__getattr__ # Should have all attributes of proxy
|
||||
|
||||
@@ -21,8 +21,9 @@ class ProxyType(Generic[_T]): # "weakproxy"
|
||||
def __getattr__(self, attr: str) -> Any: ...
|
||||
|
||||
class ReferenceType(Generic[_T]):
|
||||
__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 __init__(self, o: _T, callback: Callable[[Self], Any] | None = ..., /) -> None: ...
|
||||
def __call__(self) -> _T | None: ...
|
||||
def __eq__(self, value: object, /) -> bool: ...
|
||||
def __hash__(self) -> int: ...
|
||||
|
||||
@@ -41,7 +41,10 @@ _P = ParamSpec("_P")
|
||||
ProxyTypes: tuple[type[Any], ...]
|
||||
|
||||
class WeakMethod(ref[_CallableT]):
|
||||
def __new__(cls, meth: _CallableT, callback: Callable[[Self], object] | None = None) -> Self: ...
|
||||
# `ref` is implemented in `C` so positional-only arguments are enforced, but not in `WeakMethod`.
|
||||
def __new__( # pyright: ignore[reportInconsistentConstructor]
|
||||
cls, meth: _CallableT, callback: Callable[[Self], Any] | None = None
|
||||
) -> Self: ...
|
||||
def __call__(self) -> _CallableT | None: ...
|
||||
def __eq__(self, other: object) -> bool: ...
|
||||
def __ne__(self, other: object) -> bool: ...
|
||||
|
||||
Reference in New Issue
Block a user