fix: resolve CI/CD type errors and workflow issues
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import os
|
||||
import sys
|
||||
from pathlib import Path
|
||||
from typing import Union
|
||||
from typing import Any, Union
|
||||
|
||||
import click
|
||||
from rich import print as rprint
|
||||
@@ -14,25 +14,6 @@ from ..git import install_hook as git_install_hook
|
||||
from ..llm import OllamaProvider
|
||||
|
||||
|
||||
@click.group()
|
||||
@click.option("--config", "-c", type=click.Path(exists=True), help="Path to config file")
|
||||
@click.option("--endpoint", help="LLM endpoint URL", default=None)
|
||||
@click.option("--model", "-m", help="Model name to use", default=None)
|
||||
@click.pass_context
|
||||
def cli(ctx: click.Context, config: str | None, endpoint: str | None, model: str | None):
|
||||
ctx.ensure_object(dict)
|
||||
cfg_path = config or os.environ.get("AICR_CONFIG_PATH")
|
||||
cfg = get_config(cfg_path)
|
||||
|
||||
if endpoint:
|
||||
cfg.llm.endpoint = endpoint
|
||||
if model:
|
||||
cfg.llm.model = model
|
||||
|
||||
ctx.obj["config"] = cfg
|
||||
ctx.obj["repo_path"] = Path.cwd()
|
||||
|
||||
|
||||
@click.group()
|
||||
@click.option("--config", "-c", type=click.Path(exists=True), help="Path to config file")
|
||||
@click.option("--endpoint", help="LLM endpoint URL", default=None)
|
||||
@@ -59,7 +40,7 @@ def cli(ctx: click.Context, config: str | None, endpoint: str | None, model: str
|
||||
@click.option("--hook", is_flag=True, help="Run in hook mode (exit non-zero on critical)")
|
||||
@click.option("--file", "-f", multiple=True, help="Files to review (default: all staged)")
|
||||
@click.pass_context
|
||||
def review(
|
||||
def review( # noqa: PLR0913
|
||||
ctx: click.Context,
|
||||
strictness: str | None,
|
||||
output: str,
|
||||
@@ -250,9 +231,9 @@ def _get_nested_attr(obj, attr_path: str):
|
||||
return current
|
||||
|
||||
|
||||
def _set_nested_attr(obj, attr_path: str, value: str):
|
||||
def _set_nested_attr(obj, attr_path: str, value: Any) -> None:
|
||||
parts = attr_path.split(".")
|
||||
current = obj
|
||||
current: Any = obj
|
||||
for part in parts[:-1]:
|
||||
if hasattr(current, part):
|
||||
current = getattr(current, part)
|
||||
@@ -265,11 +246,11 @@ def _set_nested_attr(obj, attr_path: str, value: str):
|
||||
if getattr(type_hint, "__origin__", None) is Union:
|
||||
type_hint = type_hint.__args__[0]
|
||||
if hasattr(type_hint, "__name__"):
|
||||
if type_hint.__name__ == "int":
|
||||
if type_hint.__name__ == "int" and isinstance(value, str):
|
||||
value = int(value)
|
||||
elif type_hint.__name__ == "float":
|
||||
elif type_hint.__name__ == "float" and isinstance(value, str):
|
||||
value = float(value)
|
||||
elif type_hint.__name__ == "bool":
|
||||
elif type_hint.__name__ == "bool" and isinstance(value, str):
|
||||
value = value.lower() in ("true", "1", "yes")
|
||||
setattr(current, final_attr, value)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user