Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update rgbgradientv2.py #225

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 4 additions & 7 deletions rivalcfg/handlers/rgbgradientv2.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,18 +143,18 @@ def process_value(setting_info, colors):
elif is_rgbgradient(colors)[0]:
duration, gradient = _handle_rgbgradient_string(colors)
else:
raise ValueError("Not a valid color or rgbgradient %s" % str(colors))
raise ValueError(f"Not a valid color or rgbgradient {str(colors)}")

# -- Check

if len(gradient) == 0:
raise ValueError("no color: %s" % str(colors))
raise ValueError(f"no color: {str(colors)}")

# SSE allowes a maximun of 14 rgbgradient patterns but there is room in the
# command for up to 16 rgbgradient patterns and it will take 16 arguments.
gradient_length = len(gradient)
if gradient_length > maxgradient:
raise ValueError("a maximum of %i color stops are allowed" % (maxgradient))
raise ValueError(f"a maximum of {maxgradient} color stops are allowed")

# SSE limits minimum duration depening the the amount of gradient arguments
minimum_duration = int(gradient_length * 33.3)
Expand Down Expand Up @@ -257,10 +257,7 @@ def add_cli_option(cli_parser, setting_name, setting_info):
:param dict setting_info: The information dict of the setting from the
device profile.
"""
description = "%s (default: %s)" % (
setting_info["description"],
str(setting_info["default"]).replace("%", "%%"),
)
description = f'{setting_info["description"]} (default: {str(setting_info["default"]).replace("%", "%%")})'
cli_parser.add_argument(
*setting_info["cli"],
dest=setting_name,
Expand Down