Commit 17f45448 authored by Jan Reimes's avatar Jan Reimes
Browse files

fix: resolve PLC0415 lint errors - move imports to top level

parent 6b59eb20
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -8,16 +8,18 @@ from typing import TYPE_CHECKING
import typer
from rich.console import Console

if TYPE_CHECKING:
from tdoc_crawler.config import TDocCrawlerConfig

if TYPE_CHECKING:
    pass

console = Console()


def load_cli_config(
    ctx: typer.Context,
    config_file: Path | None = None,
) -> "TDocCrawlerConfig":
) -> TDocCrawlerConfig:
    """Load and validate TDocCrawlerConfig for CLI use.

    Loads config from (in precedence order):
@@ -39,8 +41,6 @@ def load_cli_config(
    Raises:
        typer.Exit: If config validation fails
    """
    from tdoc_crawler.config import TDocCrawlerConfig

    try:
        # Load config with optional explicit file
        config = TDocCrawlerConfig.from_settings(
+2 −3
Original line number Diff line number Diff line
@@ -13,6 +13,7 @@ from tdoc_crawler.cli.config import load_cli_config
from tdoc_crawler.cli.crawl import crawl_specs
from tdoc_crawler.cli.query import query_specs
from tdoc_crawler.cli.specs import checkout_spec, open_spec
from tdoc_crawler.config import CacheManager
from tdoc_crawler.logging import DEFAULT_LEVEL as DEFAULT_VERBOSITY
from tdoc_crawler.logging import set_verbosity

@@ -41,12 +42,10 @@ def _spec_app_callback(
) -> None:
    """Global CLI options for the spec-only app."""
    # Load and validate config at startup
    config = load_cli_config(ctx, config_file)
    load_cli_config(ctx, config_file)

    # Handle deprecated --cache-dir
    if cache_dir:
        from tdoc_crawler.config import CacheManager

        console.print("[yellow]Warning: --cache-dir is deprecated, use config file[/yellow]")
        CacheManager(cache_dir).register()