diff --git a/lib/view/colors.py b/lib/view/colors.py index 24e56eef1..aeedd49c6 100755 --- a/lib/view/colors.py +++ b/lib/view/colors.py @@ -16,10 +16,9 @@ # # Author: Mauro Soria -import string +import re from colorama import init, Fore, Back, Style -from pyparsing import Literal, Word, Combine, Optional, Suppress, delimitedList, oneOf BACK_COLORS = { @@ -50,13 +49,8 @@ "normal": "" } -# Credit: https://stackoverflow.com/a/2187024/12238982 -_escape_seq = Combine( - Literal("\x1b") - + "[" - + Optional(delimitedList(Word(string.digits), ";")) - + oneOf(list(string.ascii_letters)) -) +# Credit: https://stackoverflow.com/a/14693789 +_ansi_escape = re.compile(r'\x1B(?:[@-Z\\-_]|\[[0-?]*[ -/]*[@-~])') init() @@ -76,4 +70,4 @@ def set_color(msg, fore="none", back="none", style="normal"): def clean_color(msg): - return Suppress(_escape_seq).transformString(msg) + return _ansi_escape.sub("", msg) diff --git a/requirements.txt b/requirements.txt index be90c2aef..3b2441360 100644 --- a/requirements.txt +++ b/requirements.txt @@ -9,7 +9,6 @@ requests>=2.27.0 requests_ntlm>=1.1.0 colorama>=0.4.4 ntlm_auth>=1.5.0 -pyparsing>=2.4.7 beautifulsoup4>=4.8.0 mysql-connector-python>=8.0.20 psycopg[binary]>=3.0