MCPcopy Create free account
hub / github.com/ParzivalHack/PySpector / load_config

Function load_config

src/pyspector/config.py:42–53  ·  view source on GitHub ↗

Loads configuration from a TOML file or returns defaults.

(config_path: Path)

Source from the content-addressed store, hash-verified

40}
41
42def load_config(config_path: Path) -> dict:
43 """Loads configuration from a TOML file or returns defaults."""
44 if config_path and config_path.exists():
45 try:
46 with config_path.open('r') as f:
47 user_config = toml.load(f).get('tool', {}).get('pyspector', {})
48 config = deepcopy(DEFAULT_CONFIG)
49 config.update(user_config)
50 return config
51 except Exception as e:
52 click.echo(click.style(f"Warning: Could not parse config file '{config_path}'. Using defaults. Error: {e}", fg="yellow"))
53 return deepcopy(DEFAULT_CONFIG)
54
55def get_default_rules(ai_scan: bool = False) -> str:
56 """Loads the built-in TOML rules file from package resources.

Calls

no outgoing calls