Debian Codegraph @

jedi/third_party/typeshed/stdlib/textwrap.pyi

raw symbols SCIP
1 from collections.abc import Callable
2 from re import Pattern
3
4 __all__ = ["TextWrapper", "wrap", "fill", "dedent", "indent", "shorten"]
5
6 class TextWrapper:
7 width: int
8 initial_indent: str
9 subsequent_indent: str
10 expand_tabs: bool
11 replace_whitespace: bool
12 fix_sentence_endings: bool
13 drop_whitespace: bool
14 break_long_words: bool
15 break_on_hyphens: bool
16 tabsize: int
17 max_lines: int | None
18 placeholder: str
19
20 # Attributes not present in documentation
21 sentence_end_re: Pattern[str]
22 wordsep_re: Pattern[str]
23 wordsep_simple_re: Pattern[str]
24 whitespace_trans: str
25 unicode_whitespace_trans: dict[int, int]
26 uspace: int
27 x: str # leaked loop variable
28 def __init__(
29 self,
30 width: int = 70,
31 initial_indent: str = "",
32 subsequent_indent: str = "",
33 expand_tabs: bool = True,
34 replace_whitespace: bool = True,
35 fix_sentence_endings: bool = False,
36 break_long_words: bool = True,
37 drop_whitespace: bool = True,
38 break_on_hyphens: bool = True,
39 tabsize: int = 8,
40 *,
41 max_lines: int | None = None,
42 placeholder: str = " [...]",
43 ) -> None: ...
44 # Private methods *are* part of the documented API for subclasses.
45 def _munge_whitespace(self, text: str) -> str: ...
46 def _split(self, text: str) -> list[str]: ...
47 def _fix_sentence_endings(self, chunks: list[str]) -> None: ...
48 def _handle_long_word(self, reversed_chunks: list[str], cur_line: list[str], cur_len: int, width: int) -> None: ...
49 def _wrap_chunks(self, chunks: list[str]) -> list[str]: ...
50 def _split_chunks(self, text: str) -> list[str]: ...
51 def wrap(self, text: str) -> list[str]: ...
52 def fill(self, text: str) -> str: ...
53
54 def wrap(
55 text: str,
56 width: int = 70,
57 *,
58 initial_indent: str = "",
59 subsequent_indent: str = "",
60 expand_tabs: bool = True,
61 tabsize: int = 8,
62 replace_whitespace: bool = True,
63 fix_sentence_endings: bool = False,
64 break_long_words: bool = True,
65 break_on_hyphens: bool = True,
66 drop_whitespace: bool = True,
67 max_lines: int | None = None,
68 placeholder: str = " [...]",
69 ) -> list[str]: ...
70 def fill(
71 text: str,
72 width: int = 70,
73 *,
74 initial_indent: str = "",
75 subsequent_indent: str = "",
76 expand_tabs: bool = True,
77 tabsize: int = 8,
78 replace_whitespace: bool = True,
79 fix_sentence_endings: bool = False,
80 break_long_words: bool = True,
81 break_on_hyphens: bool = True,
82 drop_whitespace: bool = True,
83 max_lines: int | None = None,
84 placeholder: str = " [...]",
85 ) -> str: ...
86 def shorten(
87 text: str,
88 width: int,
89 *,
90 initial_indent: str = "",
91 subsequent_indent: str = "",
92 expand_tabs: bool = True,
93 tabsize: int = 8,
94 replace_whitespace: bool = True,
95 fix_sentence_endings: bool = False,
96 break_long_words: bool = True,
97 break_on_hyphens: bool = True,
98 drop_whitespace: bool = True,
99 # Omit `max_lines: int = None`, it is forced to 1 here.
100 placeholder: str = " [...]",
101 ) -> str: ...
102 def dedent(text: str) -> str: ...
103 def indent(text: str, prefix: str, predicate: Callable[[str], bool] | None = None) -> str: ...