Skip to content

Commit

Permalink
Merge pull request #39 from cs50/develop
Browse files Browse the repository at this point in the history
using yellow instead of dark
  • Loading branch information
Kareem Zidane authored Nov 2, 2017
2 parents a849276 + a82d84e commit 55ea312
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@
package_dir={"": "src"},
packages=["cs50"],
url="https://github.com/cs50/python-cs50",
version="2.3.0"
version="2.3.1"
)
7 changes: 4 additions & 3 deletions src/cs50/cs50.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()


Expand Down

0 comments on commit 55ea312

Please sign in to comment.