From 67cdb0b8c83e469c73d1a41b5a769c31efa5da61 Mon Sep 17 00:00:00 2001 From: Celes Renata Date: Sun, 12 Apr 2026 02:47:47 -0700 Subject: [PATCH] phase 17: fix ruff lint error in scheduler import order --- services/scheduler/app.py | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/services/scheduler/app.py b/services/scheduler/app.py index 318483b..1a33800 100644 --- a/services/scheduler/app.py +++ b/services/scheduler/app.py @@ -12,21 +12,6 @@ import logging from datetime import datetime from typing import Any, Optional - -def _ensure_dict(val: Any) -> Optional[dict]: - """Coerce a JSONB value (dict or JSON string) to a Python dict.""" - if val is None: - return None - if isinstance(val, dict): - return val - if isinstance(val, str): - try: - parsed = json.loads(val) - return parsed if isinstance(parsed, dict) else None - except (json.JSONDecodeError, TypeError): - return None - return None - import asyncpg import redis.asyncio as aioredis @@ -42,6 +27,21 @@ from services.shared.redis_keys import ( logger = logging.getLogger("scheduler") + +def _ensure_dict(val: Any) -> Optional[dict]: + """Coerce a JSONB value (dict or JSON string) to a Python dict.""" + if val is None: + return None + if isinstance(val, dict): + return val + if isinstance(val, str): + try: + parsed = json.loads(val) + return parsed if isinstance(parsed, dict) else None + except (json.JSONDecodeError, TypeError): + return None + return None + # Default polling cadences by source class (seconds). # Individual sources can override via config.polling_interval_seconds. DEFAULT_CADENCES: dict[str, int] = {