3 from typing import Any, Callable, Iterable, Mapping, Sequence, Text
4 from typing_extensions import SupportsIndex
6 from markupsafe._compat import text_type
7 from markupsafe._native import escape as escape, escape_silent as escape_silent, soft_unicode as soft_unicode
9 class Markup(text_type):
10 def __new__(cls, base: Text = ..., encoding: Text | None = ..., errors: Text = ...) -> Markup: ...
11 def __html__(self) -> Markup: ...
12 def __add__(self, other: text_type) -> Markup: ...
13 def __radd__(self, other: text_type) -> Markup: ...
14 def __mul__(self, num: int) -> Markup: ... # type: ignore
15 def __rmul__(self, num: int) -> Markup: ... # type: ignore
16 def __mod__(self, *args: Any) -> Markup: ...
17 def join(self, seq: Iterable[text_type]) -> Markup: ...
18 def split(self, sep: text_type | None = ..., maxsplit: SupportsIndex = ...) -> list[Markup]: ... # type: ignore
19 def rsplit(self, sep: text_type | None = ..., maxsplit: SupportsIndex = ...) -> list[Markup]: ... # type: ignore
20 def splitlines(self, keepends: bool = ...) -> list[Markup]: ... # type: ignore
21 def unescape(self) -> Text: ...
22 def striptags(self) -> Text: ...
24 def escape(cls, s: text_type) -> Markup: ... # noqa: F811
25 def partition(self, sep: text_type) -> tuple[Markup, Markup, Markup]: ...
26 def rpartition(self, sep: text_type) -> tuple[Markup, Markup, Markup]: ...
27 def format(self, *args: Any, **kwargs: Any) -> Markup: ...
28 def __html_format__(self, format_spec: text_type) -> Markup: ...
29 def __getslice__(self, start: int, stop: int) -> Markup: ...
30 def __getitem__(self, i: int | slice) -> Markup: ...
31 def capitalize(self) -> Markup: ...
32 def title(self) -> Markup: ...
33 def lower(self) -> Markup: ...
34 def upper(self) -> Markup: ...
35 def swapcase(self) -> Markup: ...
36 def replace(self, old: text_type, new: text_type, count: SupportsIndex = ...) -> Markup: ...
37 def ljust(self, width: SupportsIndex, fillchar: text_type = ...) -> Markup: ...
38 def rjust(self, width: SupportsIndex, fillchar: text_type = ...) -> Markup: ...
39 def lstrip(self, chars: text_type | None = ...) -> Markup: ...
40 def rstrip(self, chars: text_type | None = ...) -> Markup: ...
41 def strip(self, chars: text_type | None = ...) -> Markup: ...
42 def center(self, width: SupportsIndex, fillchar: text_type = ...) -> Markup: ...
43 def zfill(self, width: SupportsIndex) -> Markup: ...
44 def translate(self, table: Mapping[int, int | text_type | None] | Sequence[int | text_type | None]) -> Markup: ...
45 if sys.version_info >= (3, 8):
46 def expandtabs(self, tabsize: SupportsIndex = ...) -> Markup: ...
48 def expandtabs(self, tabsize: int = ...) -> Markup: ...
50 class EscapeFormatter(string.Formatter):
51 escape: Callable[[text_type], Markup]
52 def __init__(self, escape: Callable[[text_type], Markup]) -> None: ... # noqa: F811
53 def format_field(self, value: text_type, format_spec: text_type) -> Markup: ...
55 if sys.version_info >= (3,):
56 soft_str = soft_unicode