MCPcopy Create free account
hub / github.com/CITGuru/PyInquirer / remove_ansi_escape_sequences

Function remove_ansi_escape_sequences

tests/helpers.py:85–91  ·  view source on GitHub ↗
(text)

Source from the content-addressed store, hash-verified

83
84
85def remove_ansi_escape_sequences(text):
86 # http://stackoverflow.com/questions/14693701/how-can-i-remove-the-ansi-escape-sequences-from-a-string-in-python
87 # remove all ansi escape sequences
88 #return regex.sub(r'(\x9b|\x1b\[)[0-?]*[ -\/]*[@-~]|[ ]*\r', '', text)
89 text = regex.sub(r'(\x9b|\x1b\[)[0-?]*[ -\/]*[@-~]', '', text)
90 text = regex.sub(r'[ \r]*\n', '\n', text) # also clean up the line endings
91 return text
92
93# helper for running sut as subprocess within pty
94# does two things

Callers 4

readlineMethod · 0.85
expectMethod · 0.85
expect_regexMethod · 0.85

Calls

no outgoing calls

Tested by 1

Used in the wild real call sites across dependent graphs

searching dependent graphs…