From d720f7609e072a7bc35c8ac280169b145d03c999 Mon Sep 17 00:00:00 2001 From: "David J. Malan" Date: Wed, 1 Nov 2017 22:52:44 -0400 Subject: [PATCH] using yellow instead of dark --- setup.py | 2 +- src/cs50/cs50.py | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/setup.py b/setup.py index ea29c0f..4063b7f 100644 --- a/setup.py +++ b/setup.py @@ -16,5 +16,5 @@ package_dir={"": "src"}, packages=["cs50"], url="https://github.com/cs50/python-cs50", - version="2.3.0" + version="2.3.1" ) diff --git a/src/cs50/cs50.py b/src/cs50/cs50.py index 190aa96..a4f3c24 100644 --- a/src/cs50/cs50.py +++ b/src/cs50/cs50.py @@ -55,14 +55,15 @@ def formatException(type, value, tb): # Absolute paths to site-packages packages = tuple(join(abspath(p), "") for p in sys.path[1:]) - # Darken lines referring to files in site-packages + # Highlight lines not referring to files in site-packages lines = [] for line in format_exception(type, value, tb): matches = re.search(r"^ File \"([^\"]+)\", line \d+, in .+", line) if matches and matches.group(1).startswith(packages): - lines += colored(line, attrs=["dark"]) - else: lines += line + else: + matches = re.search(r"^(\s*)(.*?)(\s*)$", line, re.DOTALL) + lines.append(matches.group(1) + colored(matches.group(2), "yellow") + matches.group(3)) return "".join(lines).rstrip()