mirror of
https://github.com/davidhalter/typeshed.git
synced 2026-02-16 23:13:37 +08:00
Use typing_extensions.Self instead of _typeshed.Self (#9702)
This commit is contained in:
@@ -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: ...
|
||||
|
||||
@@ -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: ...
|
||||
|
||||
Reference in New Issue
Block a user