phase 17: fix ruff lint error in scheduler import order

This commit is contained in:
Celes Renata
2026-04-12 02:47:47 -07:00
parent f2b9d6c00a
commit 67cdb0b8c8
+15 -15
View File
@@ -12,21 +12,6 @@ import logging
from datetime import datetime from datetime import datetime
from typing import Any, Optional 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 asyncpg
import redis.asyncio as aioredis import redis.asyncio as aioredis
@@ -42,6 +27,21 @@ from services.shared.redis_keys import (
logger = logging.getLogger("scheduler") 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). # Default polling cadences by source class (seconds).
# Individual sources can override via config.polling_interval_seconds. # Individual sources can override via config.polling_interval_seconds.
DEFAULT_CADENCES: dict[str, int] = { DEFAULT_CADENCES: dict[str, int] = {