Coverage for jaypore_ci/reporters/common.py: 100%
6 statements
« prev ^ index » next coverage.py v7.2.2, created at 2023-03-30 09:04 +0000
« prev ^ index » next coverage.py v7.2.2, created at 2023-03-30 09:04 +0000
1import re
3ansi_escape = re.compile(r"\x1B(?:[@-Z\\-_]|\[[0-?]*[ -/]*[@-~])")
6def clean_logs(logs):
7 """
8 Clean logs so that they don't have HTML/ANSI color codes in them.
9 """
10 for old, new in [("<", r"\<"), (">", r"\>"), ("`", '"'), ("\r", "\n")]:
11 logs = logs.replace(old, new)
12 return [line.strip() for line in ansi_escape.sub("", logs).split("\n")]