mirror of
https://github.com/davidhalter/typeshed.git
synced 2026-01-09 13:02:22 +08:00
Use typing_extensions.Self instead of _typeshed.Self (#9702)
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
from _typeshed import Self
|
||||
from typing import Any, ClassVar, NamedTuple
|
||||
from typing_extensions import Self
|
||||
|
||||
__docformat__: str
|
||||
__version__: str
|
||||
@@ -14,13 +14,7 @@ class _VersionInfo(NamedTuple):
|
||||
|
||||
class VersionInfo(_VersionInfo):
|
||||
def __new__(
|
||||
cls: type[Self],
|
||||
major: int = ...,
|
||||
minor: int = ...,
|
||||
micro: int = ...,
|
||||
releaselevel: str = ...,
|
||||
serial: int = ...,
|
||||
release: bool = ...,
|
||||
cls, major: int = ..., minor: int = ..., micro: int = ..., releaselevel: str = ..., serial: int = ..., release: bool = ...
|
||||
) -> Self: ...
|
||||
|
||||
__version_info__: VersionInfo
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import xml.dom.minidom
|
||||
from _typeshed import Incomplete, Self
|
||||
from _typeshed import Incomplete
|
||||
from abc import abstractmethod
|
||||
from collections.abc import Callable, Generator, Iterable, Sequence
|
||||
from typing import Any, ClassVar, Protocol, TypeVar, overload
|
||||
from typing_extensions import Literal
|
||||
from typing_extensions import Literal, Self
|
||||
|
||||
from docutils.transforms import Transformer
|
||||
|
||||
@@ -26,9 +26,9 @@ class Node:
|
||||
# (although it's not used in the docutils implementation) because it
|
||||
# makes Mypy reject Node() with "Cannot instantiate abstract class".
|
||||
@abstractmethod
|
||||
def copy(self: Self) -> Self: ...
|
||||
def copy(self) -> Self: ...
|
||||
@abstractmethod
|
||||
def deepcopy(self: Self) -> Self: ...
|
||||
def deepcopy(self) -> Self: ...
|
||||
@abstractmethod
|
||||
def pformat(self, indent: str = ..., level: int = ...) -> str: ...
|
||||
@abstractmethod
|
||||
@@ -97,9 +97,9 @@ class Element(Node):
|
||||
def __delitem__(self, key: str | int | slice) -> None: ...
|
||||
def __add__(self, other: list[Node]) -> list[Node]: ...
|
||||
def __radd__(self, other: list[Node]) -> list[Node]: ...
|
||||
def __iadd__(self: Self, other: Node | Iterable[Node]) -> Self: ...
|
||||
def copy(self: Self) -> Self: ...
|
||||
def deepcopy(self: Self) -> Self: ...
|
||||
def __iadd__(self, other: Node | Iterable[Node]) -> Self: ...
|
||||
def copy(self) -> Self: ...
|
||||
def deepcopy(self) -> Self: ...
|
||||
def pformat(self, indent: str = ..., level: int = ...) -> str: ...
|
||||
def astext(self) -> str: ...
|
||||
def __getattr__(self, __name: str) -> Incomplete: ...
|
||||
@@ -109,11 +109,11 @@ class Text(Node, str):
|
||||
children: tuple[()]
|
||||
|
||||
# we omit the rawsource parameter because it has been deprecated and is ignored
|
||||
def __new__(cls: type[Self], data: str) -> Self: ...
|
||||
def __new__(cls, data: str) -> Self: ...
|
||||
def __init__(self, data: str) -> None: ...
|
||||
def shortrepr(self, maxlen: int = ...) -> str: ...
|
||||
def copy(self: Self) -> Self: ...
|
||||
def deepcopy(self: Self) -> Self: ...
|
||||
def copy(self) -> Self: ...
|
||||
def deepcopy(self) -> Self: ...
|
||||
def pformat(self, indent: str = ..., level: int = ...) -> str: ...
|
||||
def astext(self) -> str: ...
|
||||
def rstrip(self, chars: str | None = ...) -> str: ...
|
||||
@@ -124,8 +124,8 @@ class Root: ...
|
||||
|
||||
class document(Root, Structural, Element):
|
||||
transformer: Transformer
|
||||
def copy(self: Self) -> Self: ...
|
||||
def deepcopy(self: Self) -> Self: ...
|
||||
def copy(self) -> Self: ...
|
||||
def deepcopy(self) -> Self: ...
|
||||
def pformat(self, indent: str = ..., level: int = ...) -> str: ...
|
||||
def astext(self) -> str: ...
|
||||
def __getattr__(self, __name: str) -> Incomplete: ...
|
||||
|
||||
Reference in New Issue
Block a user