Use typing_extensions.Self instead of _typeshed.Self (#9702)

This commit is contained in:
Alex Waygood
2023-02-15 11:32:43 +01:00
committed by GitHub
parent 8cd6d81f15
commit 7180d0223b
140 changed files with 597 additions and 610 deletions

View File

@@ -3,9 +3,8 @@
# For example: `Pattern` and `Match` are not exported
# and are redefined in `regex.regex module.
from _typeshed import Self
from typing import Any, AnyStr, Generic
from typing_extensions import final
from typing_extensions import Self, final
from .regex import Match, Pattern
@@ -13,7 +12,7 @@ from .regex import Match, Pattern
class Splitter(Generic[AnyStr]):
@property
def pattern(self) -> Pattern[AnyStr]: ...
def __iter__(self: Self) -> Self: ...
def __iter__(self) -> Self: ...
def __next__(self) -> AnyStr | Any: ...
def split(self) -> AnyStr | Any: ...
@@ -21,7 +20,7 @@ class Splitter(Generic[AnyStr]):
class Scanner(Generic[AnyStr]):
@property
def pattern(self) -> Pattern[AnyStr]: ...
def __iter__(self: Self) -> Self: ...
def __iter__(self) -> Self: ...
def __next__(self) -> Match[AnyStr]: ...
def match(self) -> Match[AnyStr] | None: ...
def search(self) -> Match[AnyStr] | None: ...

View File

@@ -1,8 +1,8 @@
import sys
from _typeshed import ReadableBuffer, Self
from _typeshed import ReadableBuffer
from collections.abc import Callable, Mapping
from typing import Any, AnyStr, Generic, TypeVar, overload
from typing_extensions import Literal, final
from typing_extensions import Literal, Self, final
from . import _regex
from ._regex_core import *
@@ -565,8 +565,8 @@ class Pattern(Generic[AnyStr]):
concurrent: bool | None = ...,
timeout: float | None = ...,
) -> _regex.Scanner[bytes]: ...
def __copy__(self: Self) -> Self: ...
def __deepcopy__(self: Self) -> Self: ...
def __copy__(self) -> Self: ...
def __deepcopy__(self) -> Self: ...
if sys.version_info >= (3, 9):
def __class_getitem__(cls, item: Any) -> GenericAlias: ...
@@ -644,7 +644,7 @@ class Match(Generic[AnyStr]):
def __getitem__(self, __key: Literal[0]) -> AnyStr: ...
@overload
def __getitem__(self, __key: int | str) -> AnyStr | Any: ...
def __copy__(self: Self) -> Self: ...
def __deepcopy__(self: Self) -> Self: ...
def __copy__(self) -> Self: ...
def __deepcopy__(self) -> Self: ...
if sys.version_info >= (3, 9):
def __class_getitem__(cls, item: Any) -> GenericAlias: ...