pyright/ruff error fixes. Autoinstall check of autocomplete

This commit is contained in:
2026-05-25 19:03:00 +02:00
parent 17fcf1a02c
commit 32acfa6b9f
4 changed files with 61 additions and 41 deletions
+5 -15
View File
@@ -105,9 +105,7 @@ def list_presets(
@app.command()
def generate(
image_path: Optional[Path] = typer.Option(
None, help="Path to source image. Required for image mode."
),
image_path: Optional[Path] = typer.Option(None, help="Path to source image. Required for image mode."),
scheme: Optional[str] = typer.Option(
None,
help="Color scheme algorithm to use for image mode. Ignored in preset mode.",
@@ -266,15 +264,11 @@ def generate(
def harmonize(from_hct: Hct, to_hct: Hct, tone_boost: float) -> Hct:
diff = difference_degrees(from_hct.hue, to_hct.hue)
rotation = min(diff * 0.8, 100)
output_hue = sanitize_degrees_double(
from_hct.hue + rotation * rotation_direction(from_hct.hue, to_hct.hue)
)
output_hue = sanitize_degrees_double(from_hct.hue + rotation * rotation_direction(from_hct.hue, to_hct.hue))
tone = max(0.0, min(100.0, from_hct.tone * (1 + tone_boost)))
return Hct.from_hct(output_hue, from_hct.chroma, tone)
def terminal_palette(
colors: dict[str, str], mode: str, variant: str
) -> dict[str, str]:
def terminal_palette(colors: dict[str, str], mode: str, variant: str) -> dict[str, str]:
light = mode.lower() == "light"
key_hex = (
@@ -576,17 +570,13 @@ def generate(
schemes = list_schemes()
if accent and p_scheme in schemes:
meta = schemes[p_scheme]
var_accents = next(
(v.accents for v in meta.variants if v.id == p_variant), ()
)
var_accents = next((v.accents for v in meta.variants if v.id == p_variant), ())
if accent not in var_accents:
available = ", ".join(var_accents) if var_accents else "none"
raise typer.BadParameter(
f"Accent '{accent}' not available for '{p_scheme}:{p_variant}'. Available accents: {available}"
)
palette_obj = get_palette(
p_scheme, p_variant, mode or config_mode, accent=accent
)
palette_obj = get_palette(p_scheme, p_variant, mode or config_mode, accent=accent)
colors = palette_obj.colors
effective_mode = palette_obj.mode
name = palette_obj.scheme