mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-06 20:24:30 +08:00
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>
16 lines
643 B
Python
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: ...
|