Code
Hub
Workspaces
Following
Digest
Agents
Trending
Connect
MCP
copy
Index your code
hub
/
github.com/python/cpython
/ stripcolor
Function
stripcolor
Lib/_pyrepl/completing_reader.py:55–56 ·
view source on GitHub ↗
(s: str)
Source
from the content-addressed store, hash-verified
53
STRIPCOLOR_REGEX = re.compile(r
"\x1B\[([0-9]{1,3}(;[0-9]{1,2})?)?[m|K]"
)
54
55
def
stripcolor(s: str) -> str:
56
return
STRIPCOLOR_REGEX.sub(
''
, s)
57
58
59
def
real_len(s: str) -> int:
Callers
6
test_get_completions_sorts_colored_matches_by_visible_text
Method · 0.90
test_colorized_match_is_stripped
Method · 0.90
real_len
Function · 0.85
left_align
Function · 0.85
do
Method · 0.85
do
Method · 0.85
Calls
1
sub
Method · 0.45
Tested by
2
test_get_completions_sorts_colored_matches_by_visible_text
Method · 0.72
test_colorized_match_is_stripped
Method · 0.72
Used in the wild
real call sites across dependent graphs
searching dependent graphs…