in scancode/scanCode.py [0:0]
def colors():
"""Create a collection of helper functions to colorize strings."""
ansi = hasattr(sys.stderr, "isatty") and platform.system() != "Windows"
def colorize(code, string):
# Enable ANSI terminal color only around string provided (if valid)
return "%s%s%s" % (code, string, '\033[0m') if ansi else string
def cyan(s):
return colorize(CYAN, s)
def green(s):
return colorize(GREEN, s)
def red(s):
return colorize(RED, s)
def yellow(s):
return colorize(YELLOW, s)
return collections.namedtuple(
"Colorizer",
"cyan green red yellow")(cyan, green, red, yellow)