massive update, probably broken
[dotfiles/.git] / .config / coc / extensions / node_modules / coc-pyright / node_modules / pyright / dist / typeshed-fallback / stdlib / weakref.pyi
1 from _weakrefset import WeakSet as WeakSet
2 from typing import Any, Callable, Generic, Iterable, Iterator, Mapping, MutableMapping, Tuple, Type, TypeVar, overload
3
4 from _weakref import (
5     CallableProxyType as CallableProxyType,
6     ProxyType as ProxyType,
7     ReferenceType as ReferenceType,
8     getweakrefcount as getweakrefcount,
9     getweakrefs as getweakrefs,
10     proxy as proxy,
11     ref as ref,
12 )
13
14 _S = TypeVar("_S")
15 _T = TypeVar("_T")
16 _KT = TypeVar("_KT")
17 _VT = TypeVar("_VT")
18 _CallableT = TypeVar("_CallableT", bound=Callable[..., Any])
19
20 ProxyTypes: Tuple[Type[Any], ...]
21
22 class WeakMethod(ref[_CallableT], Generic[_CallableT]):
23     def __new__(cls, meth: _CallableT, callback: Callable[[_CallableT], object] | None = ...) -> WeakMethod[_CallableT]: ...
24     def __call__(self) -> _CallableT | None: ...
25
26 class WeakValueDictionary(MutableMapping[_KT, _VT]):
27     @overload
28     def __init__(self) -> None: ...
29     @overload
30     def __init__(self, __other: Mapping[_KT, _VT] | Iterable[tuple[_KT, _VT]], **kwargs: _VT) -> None: ...
31     def __len__(self) -> int: ...
32     def __getitem__(self, k: _KT) -> _VT: ...
33     def __setitem__(self, k: _KT, v: _VT) -> None: ...
34     def __delitem__(self, v: _KT) -> None: ...
35     def __contains__(self, o: object) -> bool: ...
36     def __iter__(self) -> Iterator[_KT]: ...
37     def __str__(self) -> str: ...
38     def copy(self) -> WeakValueDictionary[_KT, _VT]: ...
39     # These are incompatible with Mapping
40     def keys(self) -> Iterator[_KT]: ...  # type: ignore
41     def values(self) -> Iterator[_VT]: ...  # type: ignore
42     def items(self) -> Iterator[tuple[_KT, _VT]]: ...  # type: ignore
43     def itervaluerefs(self) -> Iterator[KeyedRef[_KT, _VT]]: ...
44     def valuerefs(self) -> list[KeyedRef[_KT, _VT]]: ...
45     def setdefault(self, key: _KT, default: _VT = ...) -> _VT: ...
46     @overload
47     def pop(self, key: _KT) -> _VT: ...
48     @overload
49     def pop(self, key: _KT, default: _VT | _T = ...) -> _VT | _T: ...
50
51 class KeyedRef(ref[_T], Generic[_KT, _T]):
52     key: _KT
53     # This __new__ method uses a non-standard name for the "cls" parameter
54     def __new__(type, ob: _T, callback: Callable[[_T], Any], key: _KT) -> KeyedRef[_KT, _T]: ...  # type: ignore
55     def __init__(self, ob: _T, callback: Callable[[_T], Any], key: _KT) -> None: ...
56
57 class WeakKeyDictionary(MutableMapping[_KT, _VT]):
58     @overload
59     def __init__(self, dict: None = ...) -> None: ...
60     @overload
61     def __init__(self, dict: Mapping[_KT, _VT] | Iterable[tuple[_KT, _VT]]) -> None: ...
62     def __len__(self) -> int: ...
63     def __getitem__(self, k: _KT) -> _VT: ...
64     def __setitem__(self, k: _KT, v: _VT) -> None: ...
65     def __delitem__(self, v: _KT) -> None: ...
66     def __contains__(self, o: object) -> bool: ...
67     def __iter__(self) -> Iterator[_KT]: ...
68     def __str__(self) -> str: ...
69     def copy(self) -> WeakKeyDictionary[_KT, _VT]: ...
70     # These are incompatible with Mapping
71     def keys(self) -> Iterator[_KT]: ...  # type: ignore
72     def values(self) -> Iterator[_VT]: ...  # type: ignore
73     def items(self) -> Iterator[tuple[_KT, _VT]]: ...  # type: ignore
74     def keyrefs(self) -> list[ref[_KT]]: ...
75     def setdefault(self, key: _KT, default: _VT = ...) -> _VT: ...
76     @overload
77     def pop(self, key: _KT) -> _VT: ...
78     @overload
79     def pop(self, key: _KT, default: _VT | _T = ...) -> _VT | _T: ...
80
81 class finalize:
82     def __init__(self, __obj: object, __func: Callable[..., Any], *args: Any, **kwargs: Any) -> None: ...
83     def __call__(self, _: Any = ...) -> Any | None: ...
84     def detach(self) -> tuple[Any, Any, Tuple[Any, ...], dict[str, Any]] | None: ...
85     def peek(self) -> tuple[Any, Any, Tuple[Any, ...], dict[str, Any]] | None: ...
86     alive: bool
87     atexit: bool