mirror of
https://github.com/davidhalter/typeshed.git
synced 2026-05-26 02:08:42 +08:00
Use SupportsIndex where applicable for 5 classes (#5694)
Use `SupportsIndex` where applicable: * `str` * `bytes` * `bytearray` * `memoryview` * `markupsafe.Markup`
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import string
|
||||
import sys
|
||||
from typing import Any, Callable, Iterable, Mapping, Optional, Sequence, Text, Tuple, Union
|
||||
from typing_extensions import SupportsIndex
|
||||
|
||||
from markupsafe._compat import text_type
|
||||
from markupsafe._native import escape as escape, escape_silent as escape_silent, soft_unicode as soft_unicode
|
||||
@@ -10,12 +11,12 @@ class Markup(text_type):
|
||||
def __html__(self) -> Markup: ...
|
||||
def __add__(self, other: text_type) -> Markup: ...
|
||||
def __radd__(self, other: text_type) -> Markup: ...
|
||||
def __mul__(self, num: int) -> Markup: ...
|
||||
def __rmul__(self, num: int) -> Markup: ...
|
||||
def __mul__(self, num: int) -> Markup: ... # type: ignore
|
||||
def __rmul__(self, num: int) -> Markup: ... # type: ignore
|
||||
def __mod__(self, *args: Any) -> Markup: ...
|
||||
def join(self, seq: Iterable[text_type]) -> Markup: ...
|
||||
def split(self, sep: Optional[text_type] = ..., maxsplit: int = ...) -> list[Markup]: ... # type: ignore
|
||||
def rsplit(self, sep: Optional[text_type] = ..., maxsplit: int = ...) -> list[Markup]: ... # type: ignore
|
||||
def split(self, sep: Optional[text_type] = ..., maxsplit: SupportsIndex = ...) -> list[Markup]: ... # type: ignore
|
||||
def rsplit(self, sep: Optional[text_type] = ..., maxsplit: SupportsIndex = ...) -> list[Markup]: ... # type: ignore
|
||||
def splitlines(self, keepends: bool = ...) -> list[Markup]: ... # type: ignore
|
||||
def unescape(self) -> Text: ...
|
||||
def striptags(self) -> Text: ...
|
||||
@@ -32,18 +33,21 @@ class Markup(text_type):
|
||||
def lower(self) -> Markup: ...
|
||||
def upper(self) -> Markup: ...
|
||||
def swapcase(self) -> Markup: ...
|
||||
def replace(self, old: text_type, new: text_type, count: int = ...) -> Markup: ...
|
||||
def ljust(self, width: int, fillchar: text_type = ...) -> Markup: ...
|
||||
def rjust(self, width: int, fillchar: text_type = ...) -> Markup: ...
|
||||
def replace(self, old: text_type, new: text_type, count: SupportsIndex = ...) -> Markup: ...
|
||||
def ljust(self, width: SupportsIndex, fillchar: text_type = ...) -> Markup: ...
|
||||
def rjust(self, width: SupportsIndex, fillchar: text_type = ...) -> Markup: ...
|
||||
def lstrip(self, chars: Optional[text_type] = ...) -> Markup: ...
|
||||
def rstrip(self, chars: Optional[text_type] = ...) -> Markup: ...
|
||||
def strip(self, chars: Optional[text_type] = ...) -> Markup: ...
|
||||
def center(self, width: int, fillchar: text_type = ...) -> Markup: ...
|
||||
def zfill(self, width: int) -> Markup: ...
|
||||
def center(self, width: SupportsIndex, fillchar: text_type = ...) -> Markup: ...
|
||||
def zfill(self, width: SupportsIndex) -> Markup: ...
|
||||
def translate(
|
||||
self, table: Union[Mapping[int, Union[int, text_type, None]], Sequence[Union[int, text_type, None]]]
|
||||
) -> Markup: ...
|
||||
def expandtabs(self, tabsize: int = ...) -> Markup: ...
|
||||
if sys.version_info >= (3, 8):
|
||||
def expandtabs(self, tabsize: SupportsIndex = ...) -> Markup: ...
|
||||
else:
|
||||
def expandtabs(self, tabsize: int = ...) -> Markup: ...
|
||||
|
||||
class EscapeFormatter(string.Formatter):
|
||||
escape: Callable[[text_type], Markup]
|
||||
|
||||
Reference in New Issue
Block a user