mirror of
https://github.com/davidhalter/typeshed.git
synced 2026-02-27 03:52:19 +08:00
Use _typeshed.IdentityFunction more consistently (#8063)
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import abc
|
||||
from _typeshed import Self
|
||||
from collections.abc import Callable, ItemsView, KeysView, Mapping, ValuesView
|
||||
from _typeshed import IdentityFunction, Self
|
||||
from collections.abc import ItemsView, KeysView, Mapping, ValuesView
|
||||
from typing import Any, Generic, TypeVar, overload
|
||||
|
||||
_T = TypeVar("_T")
|
||||
@@ -54,6 +54,6 @@ class NoReturn: ...
|
||||
# a class decorator, but mypy does not support type[_T] for abstract
|
||||
# classes until this issue is resolved, https://github.com/python/mypy/issues/4717.
|
||||
def trait(cls: _T) -> _T: ...
|
||||
def mypyc_attr(*attrs: str, **kwattrs: object) -> Callable[[_T], _T]: ...
|
||||
def mypyc_attr(*attrs: str, **kwattrs: object) -> IdentityFunction: ...
|
||||
|
||||
class FlexibleAlias(Generic[_T, _U]): ...
|
||||
|
||||
@@ -3,6 +3,7 @@ from __future__ import print_function
|
||||
import builtins
|
||||
import types
|
||||
import unittest
|
||||
from _typeshed import IdentityFunction
|
||||
from builtins import next as next
|
||||
from collections.abc import Callable, ItemsView, Iterable, Iterator as _Iterator, KeysView, Mapping, ValuesView
|
||||
from functools import wraps as wraps
|
||||
@@ -83,7 +84,7 @@ def raise_from(value: BaseException | type[BaseException], from_value: BaseExcep
|
||||
print_ = print
|
||||
|
||||
def with_metaclass(meta: type, *bases: type) -> type: ...
|
||||
def add_metaclass(metaclass: type) -> Callable[[_T], _T]: ...
|
||||
def add_metaclass(metaclass: type) -> IdentityFunction: ...
|
||||
def ensure_binary(s: bytes | str, encoding: str = ..., errors: str = ...) -> bytes: ...
|
||||
def ensure_str(s: bytes | str, encoding: str = ..., errors: str = ...) -> str: ...
|
||||
def ensure_text(s: bytes | str, encoding: str = ..., errors: str = ...) -> str: ...
|
||||
|
||||
Reference in New Issue
Block a user