MCPcopy
hub / github.com/Textualize/rich / strip_control_codes

Function strip_control_codes

rich/control.py:181–192  ·  view source on GitHub ↗

Remove control codes from text. Args: text (str): A string possibly contain control codes. Returns: str: String with control codes removed.

(
    text: str, _translate_table: Dict[int, None] = _CONTROL_STRIP_TRANSLATE
)

Source from the content-addressed store, hash-verified

179
180
181def strip_control_codes(
182 text: str, _translate_table: Dict[int, None] = _CONTROL_STRIP_TRANSLATE
183) -> str:
184 """Remove control codes from text.
185
186 Args:
187 text (str): A string possibly contain control codes.
188
189 Returns:
190 str: String with control codes removed.
191 """
192 return text.translate(_translate_table)
193
194
195def escape_control_codes(

Callers 5

test_strip_control_codesFunction · 0.90
__init__Method · 0.85
plainMethod · 0.85
appendMethod · 0.85
append_tokensMethod · 0.85

Calls

no outgoing calls

Tested by 1

test_strip_control_codesFunction · 0.72