Skip to content

Commit 7f2e436

Browse files
committed
fix: stub data
1 parent 376f093 commit 7f2e436

File tree

2 files changed

+13
-7
lines changed

2 files changed

+13
-7
lines changed
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
from typing import Any, Callable, TypeVar, overload
2+
from weakref import CallableProxyType
3+
4+
_C = TypeVar("_C", bound=Callable[..., Any])
5+
_T = TypeVar("_T")
6+
7+
# Return CallableProxyType if object is callable, ProxyType otherwise
8+
@overload
9+
def proxy(object: _C, callback: Callable[[_C], Any] | None = None, /) -> CallableProxyType[_C]: ...
10+
@overload
11+
def proxy(object: _T, callback: Callable[[_T], Any] | None = None, /) -> Any: ...

test-data/unit/lib-stub/weakref.pyi

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1+
from _weakref import proxy
12
from collections.abc import Callable
2-
from typing import Any, ClassVar, Generic, TypeVar, final, overload
3+
from typing import Any, ClassVar, Generic, TypeVar, final
34
from typing_extensions import Self
45

56
_C = TypeVar("_C", bound=Callable[..., Any])
@@ -17,9 +18,3 @@ class CallableProxyType(Generic[_C]): # "weakcallableproxy"
1718
def __getattr__(self, attr: str) -> Any: ...
1819
__call__: _C
1920
__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)