mirror of
https://github.com/davidhalter/typeshed.git
synced 2026-05-06 21:43:59 +08:00
stdlib: add __slots__ (#14611)
This commit is contained in:
@@ -65,6 +65,7 @@ ref = ReferenceType
|
||||
# everything below here is implemented in weakref.py
|
||||
|
||||
class WeakMethod(ref[_CallableT]):
|
||||
__slots__ = ("_func_ref", "_meth_type", "_alive", "__weakref__")
|
||||
def __new__(cls, meth: _CallableT, callback: Callable[[Self], Any] | None = None) -> Self: ...
|
||||
def __call__(self) -> _CallableT | None: ...
|
||||
def __eq__(self, other: object) -> bool: ...
|
||||
@@ -130,6 +131,7 @@ class WeakValueDictionary(MutableMapping[_KT, _VT]):
|
||||
def __ior__(self, other: Iterable[tuple[_KT, _VT]]) -> Self: ...
|
||||
|
||||
class KeyedRef(ref[_T], Generic[_KT, _T]):
|
||||
__slots__ = ("key",)
|
||||
key: _KT
|
||||
def __new__(type, ob: _T, callback: Callable[[Self], Any], key: _KT) -> Self: ...
|
||||
def __init__(self, ob: _T, callback: Callable[[Self], Any], key: _KT) -> None: ...
|
||||
@@ -185,6 +187,7 @@ class WeakKeyDictionary(MutableMapping[_KT, _VT]):
|
||||
def __ior__(self, other: Iterable[tuple[_KT, _VT]]) -> Self: ...
|
||||
|
||||
class finalize(Generic[_P, _T]):
|
||||
__slots__ = ()
|
||||
def __init__(self, obj: _T, func: Callable[_P, Any], /, *args: _P.args, **kwargs: _P.kwargs) -> None: ...
|
||||
def __call__(self, _: Any = None) -> Any | None: ...
|
||||
def detach(self) -> tuple[_T, Callable[_P, Any], tuple[Any, ...], dict[str, Any]] | None: ...
|
||||
|
||||
Reference in New Issue
Block a user