MCPcopy Index your code
hub / github.com/rspeer/python-ftfy / remove_terminal_escapes

Function remove_terminal_escapes

ftfy/fixes.py:145–155  ·  view source on GitHub ↗

r""" Strip out "ANSI" terminal escape sequences, such as those that produce colored text on Unix. >>> print(remove_terminal_escapes( ... "\033[36;44mI'm blue, da ba dee da ba doo...\033[0m" ... )) I'm blue, da ba dee da ba doo...

(text: str)

Source from the content-addressed store, hash-verified

143
144
145def remove_terminal_escapes(text: str) -> str:
146 r"""
147 Strip out "ANSI" terminal escape sequences, such as those that produce
148 colored text on Unix.
149
150 >>> print(remove_terminal_escapes(
151 ... "\033[36;44mI'm blue, da ba dee da ba doo...\033[0m"
152 ... ))
153 I'm blue, da ba dee da ba doo...
154 """
155 return ANSI_RE.sub("", text)
156
157
158def uncurl_quotes(text: str) -> str:

Callers 1

monospaced_widthFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected