13 lines
231 B
Python
13 lines
231 B
Python
from __future__ import annotations
|
|
|
|
import re
|
|
|
|
_ANSI_RE = re.compile(r"\x1B\[[0-9;]*[A-Za-z]")
|
|
|
|
|
|
def strip_ansi(s: str) -> str:
|
|
"""Remove ANSI escape sequences."""
|
|
if not s:
|
|
return ""
|
|
return _ANSI_RE.sub("", s)
|