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

Data Structures

class  Control
 

Functions

str strip_control_codes (str text, Dict[int, None] _translate_table=_CONTROL_STRIP_TRANSLATE)
 
str escape_control_codes (str text, Dict[int, str] _translate_table=CONTROL_ESCAPE)
 

Variables

list STRIP_CONTROL_CODES
 
dict _CONTROL_STRIP_TRANSLATE
 
dict CONTROL_ESCAPE
 
dict CONTROL_CODES_FORMAT
 
 console = Console()
 

Function Documentation

◆ escape_control_codes()

str escape_control_codes ( str  text,
Dict[int, str]   _translate_table = CONTROL_ESCAPE 
)
Replace control codes with their "escaped" equivalent in the given text.
(e.g. "\b" becomes "\\b")

Args:
    text (str): A string possibly containing control codes.

Returns:
    str: String with control codes replaced with their escaped version.

Definition at line 201 of file control.py.

204) -> str:
205 """Replace control codes with their "escaped" equivalent in the given text.
206 (e.g. "\b" becomes "\\b")
207
208 Args:
209 text (str): A string possibly containing control codes.
210
211 Returns:
212 str: String with control codes replaced with their escaped version.
213 """
214 return text.translate(_translate_table)
215
216
for i

References i.

◆ strip_control_codes()

str strip_control_codes ( str  text,
Dict[int, None]   _translate_table = _CONTROL_STRIP_TRANSLATE 
)
Remove control codes from text.

Args:
    text (str): A string possibly contain control codes.

Returns:
    str: String with control codes removed.

Definition at line 187 of file control.py.

189) -> str:
190 """Remove control codes from text.
191
192 Args:
193 text (str): A string possibly contain control codes.
194
195 Returns:
196 str: String with control codes removed.
197 """
198 return text.translate(_translate_table)
199
200

References i.

Variable Documentation

◆ _CONTROL_STRIP_TRANSLATE

dict _CONTROL_STRIP_TRANSLATE
protected
Initial value:
1= {
2 _codepoint: None for _codepoint in STRIP_CONTROL_CODES
3}

Definition at line 22 of file control.py.

◆ console

console = Console()

Definition at line 220 of file control.py.

◆ CONTROL_CODES_FORMAT

dict CONTROL_CODES_FORMAT
Initial value:
1= {
2 ControlType.BELL: lambda: "\x07",
3 ControlType.CARRIAGE_RETURN: lambda: "\r",
4 ControlType.HOME: lambda: "\x1b[H",
5 ControlType.CLEAR: lambda: "\x1b[2J",
6 ControlType.ENABLE_ALT_SCREEN: lambda: "\x1b[?1049h",
7 ControlType.DISABLE_ALT_SCREEN: lambda: "\x1b[?1049l",
8 ControlType.SHOW_CURSOR: lambda: "\x1b[?25h",
9 ControlType.HIDE_CURSOR: lambda: "\x1b[?25l",
10 ControlType.CURSOR_UP: lambda param: f"\x1b[{param}A",
11 ControlType.CURSOR_DOWN: lambda param: f"\x1b[{param}B",
12 ControlType.CURSOR_FORWARD: lambda param: f"\x1b[{param}C",
13 ControlType.CURSOR_BACKWARD: lambda param: f"\x1b[{param}D",
14 ControlType.CURSOR_MOVE_TO_COLUMN: lambda param: f"\x1b[{param+1}G",
15 ControlType.ERASE_IN_LINE: lambda param: f"\x1b[{param}K",
16 ControlType.CURSOR_MOVE_TO: lambda x, y: f"\x1b[{y+1};{x+1}H",
17 ControlType.SET_WINDOW_TITLE: lambda title: f"\x1b]0;{title}\x07",
18}

Definition at line 34 of file control.py.

◆ CONTROL_ESCAPE

dict CONTROL_ESCAPE
Initial value:
1= {
2 7: "\\a",
3 8: "\\b",
4 11: "\\v",
5 12: "\\f",
6 13: "\\r",
7}

Definition at line 26 of file control.py.

◆ STRIP_CONTROL_CODES

list STRIP_CONTROL_CODES
Initial value:
1= [
2 7, # Bell
3 8, # Backspace
4 11, # Vertical tab
5 12, # Form feed
6 13, # Carriage return
7]

Definition at line 15 of file control.py.