forked from aegis/pyserveX
fixed pyservectl linter errors and formatting
This commit is contained in:
@@ -11,7 +11,7 @@ import yaml
|
||||
|
||||
|
||||
@click.group("config")
|
||||
def config_cmd():
|
||||
def config_cmd() -> None:
|
||||
"""
|
||||
Configuration management commands.
|
||||
|
||||
@@ -40,7 +40,7 @@ def config_cmd():
|
||||
help="Enable strict validation (warn on unknown fields)",
|
||||
)
|
||||
@click.pass_obj
|
||||
def validate_cmd(ctx, config_file: Optional[str], strict: bool):
|
||||
def validate_cmd(ctx: Any, config_file: Optional[str], strict: bool) -> None:
|
||||
"""
|
||||
Validate a configuration file.
|
||||
|
||||
@@ -146,7 +146,7 @@ def validate_cmd(ctx, config_file: Optional[str], strict: bool):
|
||||
help="Show only a specific section (e.g., server, logging)",
|
||||
)
|
||||
@click.pass_obj
|
||||
def show_cmd(ctx, config_file: Optional[str], output_format: str, section: Optional[str]):
|
||||
def show_cmd(ctx: Any, config_file: Optional[str], output_format: str, section: Optional[str]) -> None:
|
||||
"""
|
||||
Display current configuration.
|
||||
|
||||
@@ -192,7 +192,7 @@ def show_cmd(ctx, config_file: Optional[str], output_format: str, section: Optio
|
||||
elif output_format == "table":
|
||||
from rich.tree import Tree
|
||||
|
||||
def build_tree(data, tree):
|
||||
def build_tree(data: Any, tree: Any) -> None:
|
||||
if isinstance(data, dict):
|
||||
for key, value in data.items():
|
||||
if isinstance(value, (dict, list)):
|
||||
@@ -227,7 +227,7 @@ def show_cmd(ctx, config_file: Optional[str], output_format: str, section: Optio
|
||||
help="Path to configuration file",
|
||||
)
|
||||
@click.pass_obj
|
||||
def get_cmd(ctx, key: str, config_file: Optional[str]):
|
||||
def get_cmd(ctx: Any, key: str, config_file: Optional[str]) -> None:
|
||||
"""
|
||||
Get a specific configuration value.
|
||||
|
||||
@@ -291,7 +291,7 @@ def get_cmd(ctx, key: str, config_file: Optional[str]):
|
||||
help="Path to configuration file",
|
||||
)
|
||||
@click.pass_obj
|
||||
def set_cmd(ctx, key: str, value: str, config_file: Optional[str]):
|
||||
def set_cmd(ctx: Any, key: str, value: str, config_file: Optional[str]) -> None:
|
||||
"""
|
||||
Set a configuration value.
|
||||
|
||||
@@ -357,7 +357,7 @@ def set_cmd(ctx, key: str, value: str, config_file: Optional[str]):
|
||||
@config_cmd.command("diff")
|
||||
@click.argument("file1", type=click.Path(exists=True))
|
||||
@click.argument("file2", type=click.Path(exists=True))
|
||||
def diff_cmd(file1: str, file2: str):
|
||||
def diff_cmd(file1: str, file2: str) -> None:
|
||||
"""
|
||||
Compare two configuration files.
|
||||
|
||||
@@ -373,8 +373,8 @@ def diff_cmd(file1: str, file2: str):
|
||||
with open(file2) as f:
|
||||
data2 = yaml.safe_load(f)
|
||||
|
||||
def compare_dicts(d1, d2, path=""):
|
||||
differences = []
|
||||
def compare_dicts(d1: Any, d2: Any, path: str = "") -> list[tuple[str, str, Any, Any]]:
|
||||
differences: list[tuple[str, str, Any, Any]] = []
|
||||
|
||||
all_keys = set(d1.keys() if d1 else []) | set(d2.keys() if d2 else [])
|
||||
|
||||
|
||||
Reference in New Issue
Block a user