Use _typeshed.IdentityFunction more consistently (#8063)

This commit is contained in:
Alex Waygood
2022-06-13 00:56:14 +01:00
committed by GitHub
parent 033516d39f
commit 1be5918baa
5 changed files with 11 additions and 10 deletions

View File

@@ -1,6 +1,6 @@
import sys
import types
from _typeshed import Self, SupportsAllComparisons, SupportsItems
from _typeshed import IdentityFunction, Self, SupportsAllComparisons, SupportsItems
from collections.abc import Callable, Hashable, Iterable, Sequence, Sized
from typing import Any, Generic, NamedTuple, TypeVar, overload
from typing_extensions import Literal, TypeAlias, final
@@ -68,7 +68,7 @@ WRAPPER_ASSIGNMENTS: tuple[
WRAPPER_UPDATES: tuple[Literal["__dict__"]]
def update_wrapper(wrapper: _T, wrapped: _AnyCallable, assigned: Sequence[str] = ..., updated: Sequence[str] = ...) -> _T: ...
def wraps(wrapped: _AnyCallable, assigned: Sequence[str] = ..., updated: Sequence[str] = ...) -> Callable[[_T], _T]: ...
def wraps(wrapped: _AnyCallable, assigned: Sequence[str] = ..., updated: Sequence[str] = ...) -> IdentityFunction: ...
def total_ordering(cls: type[_T]) -> type[_T]: ...
def cmp_to_key(mycmp: Callable[[_T, _T], int]) -> Callable[[_T], SupportsAllComparisons]: ...

View File

@@ -1,6 +1,6 @@
import collections # Needed by aliases like DefaultDict, see mypy issue 2986
import sys
from _typeshed import ReadableBuffer, Self as TypeshedSelf, SupportsKeysAndGetItem
from _typeshed import IdentityFunction, ReadableBuffer, Self as TypeshedSelf, SupportsKeysAndGetItem
from abc import ABCMeta, abstractmethod
from types import BuiltinFunctionType, CodeType, FrameType, FunctionType, MethodType, ModuleType, TracebackType
from typing_extensions import Literal as _Literal, ParamSpec as _ParamSpec, final as _final
@@ -874,7 +874,7 @@ if sys.version_info >= (3, 11):
kw_only_default: bool = ...,
field_specifiers: tuple[type[Any] | Callable[..., Any], ...] = ...,
**kwargs: Any,
) -> Callable[[_T], _T]: ...
) -> IdentityFunction: ...
# Type constructors

View File

@@ -1,6 +1,6 @@
import abc
import sys
from _typeshed import Self as TypeshedSelf # see #6932 for why the alias cannot have a leading underscore
from _typeshed import IdentityFunction, Self as TypeshedSelf # see #6932 for why the Self alias cannot have a leading underscore
from typing import ( # noqa: Y022,Y027,Y039
TYPE_CHECKING as TYPE_CHECKING,
Any,
@@ -232,4 +232,4 @@ else:
kw_only_default: bool = ...,
field_specifiers: tuple[type[Any] | Callable[..., Any], ...] = ...,
**kwargs: object,
) -> Callable[[_T], _T]: ...
) -> IdentityFunction: ...