Skip to content

Commit f72a0ae

Browse files
author
Michael Zingale
committed
formatting and styling
1 parent 0f78e33 commit f72a0ae

1 file changed

Lines changed: 21 additions & 9 deletions

File tree

util/msg.py

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# inspiration from
44
# http://stackoverflow.com/questions/287871/print-in-terminal-with-colors-using-python
55
# which in-turn cites the blender build scripts
6-
class termColors:
6+
class _TermColors:
77
WARNING = '\033[33m'
88
SUCCESS = '\033[32m'
99
FAIL = '\033[31m'
@@ -12,8 +12,12 @@ class termColors:
1212

1313

1414
def fail(str):
15-
new_str = termColors.FAIL + str + termColors.ENDC
16-
print new_str
15+
"""
16+
Output a string to the terminal and abort if we are running
17+
non-interactively. The string is colored red to indicate a
18+
failure
19+
"""
20+
print _TermColors.FAIL + str + _TermColors.ENDC
1721

1822
# only exit if we are not running in interactive mode. sys.ps1 is
1923
# only defined in interactive mode.
@@ -23,14 +27,22 @@ def fail(str):
2327
sys.exit()
2428

2529
def warning(str):
26-
new_str = termColors.WARNING + str + termColors.ENDC
27-
print new_str
30+
"""
31+
Output a string to the terminal colored orange to indicate a
32+
warning
33+
"""
34+
print _TermColors.WARNING + str + _TermColors.ENDC
2835

2936
def success(str):
30-
new_str = termColors.SUCCESS + str + termColors.ENDC
31-
print new_str
37+
"""
38+
Output a string to the terminal colored green to indicate
39+
success
40+
"""
41+
print _TermColors.SUCCESS + str + _TermColors.ENDC
3242

3343
def bold(str):
34-
new_str = termColors.BOLD + str + termColors.ENDC
35-
print new_str
44+
""" Output a string in a bold weight"""
45+
print _TermColors.BOLD + str + _TermColors.ENDC
46+
47+
3648

0 commit comments

Comments
 (0)