mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-16 00:37:10 +08:00
Use TypeIs for various stdlib functions (#11823)
This commit is contained in:
@@ -66,6 +66,7 @@ from typing_extensions import ( # noqa: Y023
|
||||
Self,
|
||||
TypeAlias,
|
||||
TypeGuard,
|
||||
TypeIs,
|
||||
TypeVarTuple,
|
||||
deprecated,
|
||||
)
|
||||
@@ -1241,7 +1242,7 @@ def any(iterable: Iterable[object], /) -> bool: ...
|
||||
def ascii(obj: object, /) -> str: ...
|
||||
def bin(number: int | SupportsIndex, /) -> str: ...
|
||||
def breakpoint(*args: Any, **kws: Any) -> None: ...
|
||||
def callable(obj: object, /) -> TypeGuard[Callable[..., object]]: ...
|
||||
def callable(obj: object, /) -> TypeIs[Callable[..., object]]: ...
|
||||
def chr(i: int, /) -> str: ...
|
||||
|
||||
# We define this here instead of using os.PathLike to avoid import cycle issues.
|
||||
@@ -1351,6 +1352,8 @@ class filter(Iterator[_T]):
|
||||
@overload
|
||||
def __new__(cls, function: Callable[[_S], TypeGuard[_T]], iterable: Iterable[_S], /) -> Self: ...
|
||||
@overload
|
||||
def __new__(cls, function: Callable[[_S], TypeIs[_T]], iterable: Iterable[_S], /) -> Self: ...
|
||||
@overload
|
||||
def __new__(cls, function: Callable[[_T], Any], iterable: Iterable[_T], /) -> Self: ...
|
||||
def __iter__(self) -> Self: ...
|
||||
def __next__(self) -> _T: ...
|
||||
|
||||
Reference in New Issue
Block a user