| 1 |
from _weakref import proxy |
| 2 |
from collections.abc import Callable |
| 3 |
from typing import Any, ClassVar, Generic, TypeVar, final |
| 4 |
from typing_extensions import Self |
| 5 |
|
| 6 |
_C = TypeVar("_C", bound=Callable[..., Any]) |
| 7 |
_T = TypeVar("_T") |
| 8 |
|
| 9 |
class ReferenceType(Generic[_T]): # "weakref" |
| 10 |
__callback__: Callable[[Self], Any] |
| 11 |
def __new__(cls, o: _T, callback: Callable[[Self], Any] | None = ..., /) -> Self: ... |
| 12 |
def __call__(self) -> _T | None: ... |
| 13 |
|
| 14 |
ref = ReferenceType |
| 15 |
|
| 16 |
@final |
| 17 |
class CallableProxyType(Generic[_C]): # "weakcallableproxy" |
| 18 |
def __eq__(self, value: object, /) -> bool: ... |
| 19 |
def __getattr__(self, attr: str) -> Any: ... |
| 20 |
__call__: _C |
| 21 |
__hash__: ClassVar[None] # type: ignore[assignment] |
| 22 |
|
| 23 |
__all__ = ["proxy"] |