Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
fuscia = fuchsia
# Other nice-to-have characters:
class _Characters:
def __init__(self, color, as_unicode, as_ascii):
if os.name == "nt":
self.as_string = as_ascii
else:
self.as_string = as_unicode
self.color = color
def tuple(self):
return (reset, self.color, self.as_string, reset)
ellipsis = _Characters(reset, "…", "...")
check = _Characters(green, "✓", "ok")
cross = _Characters(red, "❌","ko")
def configure_logging(args):
verbose = os.environ.get("VERBOSE", False)
if not verbose:
verbose = args.verbose
CONFIG["color"] = args.color
CONFIG["title"] = args.title
CONFIG["verbose"] = verbose
CONFIG["quiet"] = args.quiet
def using_colorama():
if os.name == "nt":
if "TERM" not in os.environ:
# Other nice-to-have characters:
class _Characters:
def __init__(self, color, as_unicode, as_ascii):
if os.name == "nt":
self.as_string = as_ascii
else:
self.as_string = as_unicode
self.color = color
def tuple(self):
return (reset, self.color, self.as_string, reset)
ellipsis = _Characters(reset, "…", "...")
check = _Characters(green, "✓", "ok")
cross = _Characters(red, "❌","ko")
def configure_logging(args):
verbose = os.environ.get("VERBOSE", False)
if not verbose:
verbose = args.verbose
CONFIG["color"] = args.color
CONFIG["title"] = args.title
CONFIG["verbose"] = verbose
CONFIG["quiet"] = args.quiet
def using_colorama():
if os.name == "nt":
if "TERM" not in os.environ:
return True
# Other nice-to-have characters:
class _Characters:
def __init__(self, color, as_unicode, as_ascii):
if os.name == "nt":
self.as_string = as_ascii
else:
self.as_string = as_unicode
self.color = color
def tuple(self):
return (reset, self.color, self.as_string, reset)
ellipsis = _Characters(reset, "…", "...")
check = _Characters(green, "✓", "ok")
cross = _Characters(red, "❌","ko")
def configure_logging(args):
verbose = os.environ.get("VERBOSE", False)
if not verbose:
verbose = args.verbose
CONFIG["color"] = args.color
CONFIG["title"] = args.title
CONFIG["verbose"] = verbose
CONFIG["quiet"] = args.quiet
def using_colorama():
if os.name == "nt":
if "TERM" not in os.environ:
return True
if os.environ["TERM"] == "cygwin":
def process_tokens(tokens, *, end="\n", sep=" "):
""" Returns two strings from a list of tokens.
One containing ASCII escape codes, the other
only the 'normal' characters
"""
# Flatten the list of tokens in case some of them are of class _Characters
flat_tokens = list()
for token in tokens:
if isinstance(token, _Characters):
flat_tokens.extend(token.tuple())
else:
flat_tokens.append(token)
with_color = _process_tokens(flat_tokens, end=end, sep=sep, color=True)
without_color = _process_tokens(flat_tokens, end=end, sep=sep, color=False)
return (with_color, without_color)