mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-09 21:46:42 +08:00
Use PEP 570 syntax in stdlib (#11250)
This commit is contained in:
@@ -11,31 +11,31 @@ _T = TypeVar("_T")
|
||||
|
||||
@final
|
||||
class CallableProxyType(Generic[_C]): # "weakcallableproxy"
|
||||
def __eq__(self, __value: object) -> bool: ...
|
||||
def __eq__(self, value: object, /) -> bool: ...
|
||||
def __getattr__(self, attr: str) -> Any: ...
|
||||
__call__: _C
|
||||
|
||||
@final
|
||||
class ProxyType(Generic[_T]): # "weakproxy"
|
||||
def __eq__(self, __value: object) -> bool: ...
|
||||
def __eq__(self, value: object, /) -> bool: ...
|
||||
def __getattr__(self, attr: str) -> Any: ...
|
||||
|
||||
class ReferenceType(Generic[_T]):
|
||||
__callback__: Callable[[ReferenceType[_T]], Any]
|
||||
def __new__(cls, __o: _T, __callback: Callable[[ReferenceType[_T]], Any] | None = ...) -> Self: ...
|
||||
def __new__(cls, o: _T, callback: Callable[[ReferenceType[_T]], Any] | None = ..., /) -> Self: ...
|
||||
def __call__(self) -> _T | None: ...
|
||||
def __eq__(self, __value: object) -> bool: ...
|
||||
def __eq__(self, value: object, /) -> bool: ...
|
||||
def __hash__(self) -> int: ...
|
||||
if sys.version_info >= (3, 9):
|
||||
def __class_getitem__(cls, item: Any) -> GenericAlias: ...
|
||||
|
||||
ref = ReferenceType
|
||||
|
||||
def getweakrefcount(__object: Any) -> int: ...
|
||||
def getweakrefs(__object: Any) -> list[Any]: ...
|
||||
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]: ...
|
||||
def proxy(object: _C, callback: Callable[[_C], Any] | None = None, /) -> CallableProxyType[_C]: ...
|
||||
@overload
|
||||
def proxy(__object: _T, __callback: Callable[[_T], Any] | None = None) -> Any: ...
|
||||
def proxy(object: _T, callback: Callable[[_T], Any] | None = None, /) -> Any: ...
|
||||
|
||||
Reference in New Issue
Block a user