phase 17: fix ruff lint error in scheduler import order
This commit is contained in:
+15
-15
@@ -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] = {
|
||||||
|
|||||||
Reference in New Issue
Block a user