Files
typeshed/stdlib/_weakref.pyi
Stephen Morton c43894568f resort weakref classes (#11165)
This improves fidelity of naming and inheritance on 3.11+

related to https://github.com/python/typeshed/issues/3968 and https://github.com/python/typeshed/issues/11141

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2024-10-01 19:50:10 -07:00

16 lines
643 B
Python

from collections.abc import Callable
from typing import Any, TypeVar, overload
from weakref import CallableProxyType as CallableProxyType, ProxyType as ProxyType, ReferenceType as ReferenceType, ref as ref
_C = TypeVar("_C", bound=Callable[..., Any])
_T = TypeVar("_T")
def getweakrefcount(object: Any, /) -> int: ...
def getweakrefs(object: Any, /) -> list[Any]: ...
# Return CallableProxyType if object is callable, ProxyType otherwise
@overload
def proxy(object: _C, callback: Callable[[_C], Any] | None = None, /) -> CallableProxyType[_C]: ...
@overload
def proxy(object: _T, callback: Callable[[_T], Any] | None = None, /) -> Any: ...