Let us walk on the 3-isogeny graph
Loading...
Searching...
No Matches
pip._vendor.rich._wrap Namespace Reference

Functions

Iterable[Tuple[int, int, str]] words (str text)
 
List[int] divide_line (str text, int width, bool fold=True)
 

Variables

 re_word = re.compile(r"\s*\S+\s*")
 
 console = Console(width=10)
 

Function Documentation

◆ divide_line()

List[int] divide_line ( str  text,
int  width,
bool   fold = True 
)

Definition at line 20 of file _wrap.py.

20def divide_line(text: str, width: int, fold: bool = True) -> List[int]:
21 divides: List[int] = []
22 append = divides.append
23 line_position = 0
24 _cell_len = cell_len
25 for start, _end, word in words(text):
26 word_length = _cell_len(word.rstrip())
27 if line_position + word_length > width:
28 if word_length > width:
29 if fold:
30 chopped_words = chop_cells(word, max_size=width, position=0)
31 for last, line in loop_last(chopped_words):
32 if start:
33 append(start)
34
35 if last:
36 line_position = _cell_len(line)
37 else:
38 start += len(line)
39 else:
40 if start:
41 append(start)
42 line_position = _cell_len(word)
43 elif line_position and start:
44 append(start)
45 line_position = _cell_len(word)
46 else:
47 line_position += _cell_len(word)
48 return divides
49
50
for i

References i, and pip._vendor.rich._wrap.words().

Here is the call graph for this function:

◆ words()

Iterable[Tuple[int, int, str]] words ( str  text)

Definition at line 10 of file _wrap.py.

10def words(text: str) -> Iterable[Tuple[int, int, str]]:
11 position = 0
12 word_match = re_word.match(text, position)
13 while word_match is not None:
14 start, end = word_match.span()
15 word = word_match.group(0)
16 yield start, end, word
17 word_match = re_word.match(text, end)
18
19

References i.

Referenced by pip._vendor.rich._wrap.divide_line().

Here is the caller graph for this function:

Variable Documentation

◆ console

console = Console(width=10)

Definition at line 54 of file _wrap.py.

◆ re_word

re_word = re.compile(r"\s*\S+\s*")

Definition at line 7 of file _wrap.py.