mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-07 12:44:28 +08:00
Use typing_extensions.Self in the stdlib (#9694)
This commit is contained in:
@@ -2,7 +2,6 @@ import dis
|
||||
import enum
|
||||
import sys
|
||||
import types
|
||||
from _typeshed import Self
|
||||
from collections import OrderedDict
|
||||
from collections.abc import AsyncGenerator, Awaitable, Callable, Coroutine, Generator, Mapping, Sequence, Set as AbstractSet
|
||||
from types import (
|
||||
@@ -26,7 +25,7 @@ from types import (
|
||||
WrapperDescriptorType,
|
||||
)
|
||||
from typing import Any, ClassVar, NamedTuple, Protocol, TypeVar, overload
|
||||
from typing_extensions import Literal, ParamSpec, TypeAlias, TypeGuard
|
||||
from typing_extensions import Literal, ParamSpec, Self, TypeAlias, TypeGuard
|
||||
|
||||
if sys.version_info >= (3, 11):
|
||||
__all__ = [
|
||||
@@ -313,13 +312,11 @@ class Signature:
|
||||
def return_annotation(self) -> Any: ...
|
||||
def bind(self, *args: Any, **kwargs: Any) -> BoundArguments: ...
|
||||
def bind_partial(self, *args: Any, **kwargs: Any) -> BoundArguments: ...
|
||||
def replace(
|
||||
self: Self, *, parameters: Sequence[Parameter] | type[_void] | None = ..., return_annotation: Any = ...
|
||||
) -> Self: ...
|
||||
def replace(self, *, parameters: Sequence[Parameter] | type[_void] | None = ..., return_annotation: Any = ...) -> Self: ...
|
||||
if sys.version_info >= (3, 10):
|
||||
@classmethod
|
||||
def from_callable(
|
||||
cls: type[Self],
|
||||
cls,
|
||||
obj: _IntrospectableCallable,
|
||||
*,
|
||||
follow_wrapped: bool = True,
|
||||
@@ -329,7 +326,7 @@ class Signature:
|
||||
) -> Self: ...
|
||||
else:
|
||||
@classmethod
|
||||
def from_callable(cls: type[Self], obj: _IntrospectableCallable, *, follow_wrapped: bool = True) -> Self: ...
|
||||
def from_callable(cls, obj: _IntrospectableCallable, *, follow_wrapped: bool = True) -> Self: ...
|
||||
|
||||
def __eq__(self, other: object) -> bool: ...
|
||||
|
||||
@@ -372,7 +369,7 @@ class Parameter:
|
||||
@property
|
||||
def annotation(self) -> Any: ...
|
||||
def replace(
|
||||
self: Self,
|
||||
self,
|
||||
*,
|
||||
name: str | type[_void] = ...,
|
||||
kind: _ParameterKind | type[_void] = ...,
|
||||
@@ -493,7 +490,7 @@ if sys.version_info >= (3, 11):
|
||||
class Traceback(_Traceback):
|
||||
positions: dis.Positions | None
|
||||
def __new__(
|
||||
cls: type[Self],
|
||||
cls,
|
||||
filename: str,
|
||||
lineno: int,
|
||||
function: str,
|
||||
@@ -514,7 +511,7 @@ if sys.version_info >= (3, 11):
|
||||
class FrameInfo(_FrameInfo):
|
||||
positions: dis.Positions | None
|
||||
def __new__(
|
||||
cls: type[Self],
|
||||
cls,
|
||||
frame: FrameType,
|
||||
filename: str,
|
||||
lineno: int,
|
||||
|
||||
Reference in New Issue
Block a user