Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
global_config (~nox.main.GlobalConfig): The global configuration.
Returns:
Union[~.Manifest,int]: ``0`` if a listing is all that is requested,
the manifest otherwise (to be sent to the next task).
"""
if not global_config.list_sessions:
return manifest
# If the user just asked for a list of sessions, print that
# and be done.
print("Sessions defined in {noxfile}:\n".format(noxfile=global_config.noxfile))
reset = parse_colors("reset") if global_config.color else ""
selected_color = parse_colors("cyan") if global_config.color else ""
skipped_color = parse_colors("white") if global_config.color else ""
for session, selected in manifest.list_all_sessions():
output = "{marker} {color}{session}{reset}"
if selected:
marker = "*"
color = selected_color
else:
marker = "-"
color = skipped_color
if session.description is not None:
output += " -> {description}"
print(
def color(self, log_colors, level_name):
"""Return escape codes from a ``log_colors`` dict."""
return parse_colors(log_colors.get(level_name, ""))
def color(self, log_colors, level_name):
"""Return escape codes from a ``log_colors`` dict."""
return parse_colors(log_colors.get(level_name, ""))
Returns:
Union[~.Manifest,int]: ``0`` if a listing is all that is requested,
the manifest otherwise (to be sent to the next task).
"""
if not global_config.list_sessions:
return manifest
# If the user just asked for a list of sessions, print that
# and be done.
print("Sessions defined in {noxfile}:\n".format(noxfile=global_config.noxfile))
reset = parse_colors("reset") if global_config.color else ""
selected_color = parse_colors("cyan") if global_config.color else ""
skipped_color = parse_colors("white") if global_config.color else ""
for session, selected in manifest.list_all_sessions():
output = "{marker} {color}{session}{reset}"
if selected:
marker = "*"
color = selected_color
else:
marker = "-"
color = skipped_color
if session.description is not None:
output += " -> {description}"
print(
output.format(
manifest (~.Manifest): The manifest of sessions to be run.
global_config (~nox.main.GlobalConfig): The global configuration.
Returns:
Union[~.Manifest,int]: ``0`` if a listing is all that is requested,
the manifest otherwise (to be sent to the next task).
"""
if not global_config.list_sessions:
return manifest
# If the user just asked for a list of sessions, print that
# and be done.
print("Sessions defined in {noxfile}:\n".format(noxfile=global_config.noxfile))
reset = parse_colors("reset") if global_config.color else ""
selected_color = parse_colors("cyan") if global_config.color else ""
skipped_color = parse_colors("white") if global_config.color else ""
for session, selected in manifest.list_all_sessions():
output = "{marker} {color}{session}{reset}"
if selected:
marker = "*"
color = selected_color
else:
marker = "-"
color = skipped_color
if session.description is not None:
output += " -> {description}"
def color(the_color, *args, reset=None):
"""Color helper."""
from colorlog.escape_codes import escape_codes, parse_colors
try:
if not args:
assert reset is None, "You cannot reset if nothing being printed"
return parse_colors(the_color)
return parse_colors(the_color) + " ".join(args) + escape_codes[reset or "reset"]
except KeyError as k:
raise ValueError("Invalid color {} in {}".format(str(k), the_color))