Satisfy flake8 so the lint job stops failing
Pure formatting, no behaviour change: strip trailing whitespace from blank lines, give top-level defs in system_cacher.py their two blank lines, wrap the long discord_radio.join signature, and split the duplicated active_config ternary in main.py and routers/api.py across lines. Verified clean with flake8 --max-line-length=120, matching CI. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5
parent
9d86304b8a
commit
7f1d09c753
@@ -8,6 +8,7 @@ from app.internal import credentials
|
||||
|
||||
_CACHE_FILE = Path(settings.config_path) / "systems_cache.json"
|
||||
|
||||
|
||||
async def fetch_and_cache_systems() -> bool:
|
||||
"""Fetch all systems from the C2 server and cache them locally."""
|
||||
if not settings.c2_url:
|
||||
@@ -23,7 +24,7 @@ async def fetch_and_cache_systems() -> bool:
|
||||
r = await client.get(url, headers=headers)
|
||||
r.raise_for_status()
|
||||
systems = r.json()
|
||||
|
||||
|
||||
_CACHE_FILE.parent.mkdir(parents=True, exist_ok=True)
|
||||
_CACHE_FILE.write_text(json.dumps(systems, indent=2))
|
||||
logger.info(f"Cached {len(systems)} systems from C2.")
|
||||
@@ -32,6 +33,7 @@ async def fetch_and_cache_systems() -> bool:
|
||||
logger.warning(f"Failed to fetch systems from C2: {e}. Offline cache will be used.")
|
||||
return False
|
||||
|
||||
|
||||
def load_cached_systems() -> List[Dict[str, Any]]:
|
||||
"""Load cached systems from disk."""
|
||||
if _CACHE_FILE.exists():
|
||||
@@ -41,6 +43,7 @@ def load_cached_systems() -> List[Dict[str, Any]]:
|
||||
logger.error(f"Failed to read systems cache: {e}")
|
||||
return []
|
||||
|
||||
|
||||
def get_cached_system(system_id: str) -> Optional[Dict[str, Any]]:
|
||||
"""Retrieve a single system config from the cache."""
|
||||
systems = load_cached_systems()
|
||||
|
||||
Reference in New Issue
Block a user