Skip to content

Commit 62306b6

Browse files
committed
fix: add weakref.proxy stuff to testdata stubs
1 parent 3c39e6e commit 62306b6

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed
Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,25 @@
11
from collections.abc import Callable
2-
from typing import Any, Generic, TypeVar
2+
from typing import Any, ClassVar, Generic, TypeVar, final, overload
33
from typing_extensions import Self
44

5+
_C = TypeVar("_C", bound=Callable[..., Any])
56
_T = TypeVar("_T")
67

78
class ReferenceType(Generic[_T]): # "weakref"
89
__callback__: Callable[[Self], Any]
910
def __new__(cls, o: _T, callback: Callable[[Self], Any] | None = ..., /) -> Self: ...
1011

1112
ref = ReferenceType
13+
14+
@final
15+
class CallableProxyType(Generic[_C]): # "weakcallableproxy"
16+
def __eq__(self, value: object, /) -> bool: ...
17+
def __getattr__(self, attr: str) -> Any: ...
18+
__call__: _C
19+
__hash__: ClassVar[None] # type: ignore[assignment]
20+
21+
# Return CallableProxyType if object is callable, ProxyType otherwise
22+
@overload
23+
def proxy(object: _C, callback: Callable[[_C], Any] | None = None, /) -> CallableProxyType[_C]: ...
24+
@overload
25+
def proxy(object: _T, callback: Callable[[_T], Any] | None = None, /) -> Any: ...

0 commit comments

Comments
 (0)