massive update, probably broken
[dotfiles/.git] / .config / coc / extensions / node_modules / coc-pyright / node_modules / pyright / dist / typeshed-fallback / stdlib / _weakref.pyi
1 import sys
2 from typing import Any, Callable, Generic, TypeVar, overload
3 from typing_extensions import final
4
5 if sys.version_info >= (3, 9):
6     from types import GenericAlias
7
8 _C = TypeVar("_C", bound=Callable[..., Any])
9 _T = TypeVar("_T")
10
11 @final
12 class CallableProxyType(Generic[_C]):  # "weakcallableproxy"
13     def __getattr__(self, attr: str) -> Any: ...
14
15 @final
16 class ProxyType(Generic[_T]):  # "weakproxy"
17     def __getattr__(self, attr: str) -> Any: ...
18
19 class ReferenceType(Generic[_T]):
20     __callback__: Callable[[ReferenceType[_T]], Any]
21     def __init__(self, o: _T, callback: Callable[[ReferenceType[_T]], Any] | None = ...) -> None: ...
22     def __call__(self) -> _T | None: ...
23     def __hash__(self) -> int: ...
24     if sys.version_info >= (3, 9):
25         def __class_getitem__(cls, item: Any) -> GenericAlias: ...
26
27 ref = ReferenceType
28
29 def getweakrefcount(__object: Any) -> int: ...
30 def getweakrefs(object: Any) -> list[Any]: ...
31 @overload
32 def proxy(object: _C, callback: Callable[[_C], Any] | None = ...) -> CallableProxyType[_C]: ...
33
34 # Return CallableProxyType if object is callable, ProxyType otherwise
35 @overload
36 def proxy(object: _T, callback: Callable[[_T], Any] | None = ...) -> Any: ...