chore(lint): apply ruff --fix (4443 auto-fixes)
Auto-fixed categories: - F401: unused imports removed - I001: import blocks sorted - W293: trailing whitespace stripped - UP035: deprecated typing imports replaced - SIM: simplify suggestions applied - ARG: unused args prefixed with underscore - T201: print statements removed - F841: unused variables removed - RUF059: unpacked variables prefixed Remaining ~1500 unfixable errors (C901, B904, N806, E402) require manual work. Backend smoke tests: 13/13 passed.
This commit is contained in:
@@ -11,7 +11,7 @@
|
||||
# @SIDE_EFFECT: Read-only database operations
|
||||
|
||||
from datetime import datetime
|
||||
from typing import Any, Dict, Optional
|
||||
from typing import Any
|
||||
|
||||
from ...core.logger import belief_scope
|
||||
from ...core.task_manager.models import Task, TaskStatus
|
||||
@@ -62,7 +62,7 @@ def build_summary(task: Task, report_status: ReportStatus) -> str:
|
||||
# @BRIEF Extract normalized error context and next actions for failed/partial reports.
|
||||
# @PRE: task is a valid Task object.
|
||||
# @POST: Returns ErrorContext for failed/partial when context exists; otherwise None.
|
||||
def extract_error_context(task: Task, report_status: ReportStatus) -> Optional[ErrorContext]:
|
||||
def extract_error_context(task: Task, report_status: ReportStatus) -> ErrorContext | None:
|
||||
with belief_scope("extract_error_context"):
|
||||
if report_status not in {ReportStatus.FAILED, ReportStatus.PARTIAL}:
|
||||
return None
|
||||
@@ -128,7 +128,7 @@ def normalize_task_report(task: Task) -> TaskReport:
|
||||
if not updated_at:
|
||||
updated_at = started_at or datetime.utcnow()
|
||||
|
||||
details: Dict[str, Any] = {
|
||||
details: dict[str, Any] = {
|
||||
"profile": {
|
||||
"display_label": profile.get("display_label"),
|
||||
"visual_variant": profile.get("visual_variant"),
|
||||
@@ -138,7 +138,7 @@ def normalize_task_report(task: Task) -> TaskReport:
|
||||
"result": task.result if task.result is not None else {"note": "Not provided"},
|
||||
}
|
||||
|
||||
source_ref: Dict[str, Any] = {}
|
||||
source_ref: dict[str, Any] = {}
|
||||
if isinstance(task.params, dict):
|
||||
for key in ("environment_id", "source_env_id", "target_env_id", "dashboard_id", "dataset_id", "resource_id"):
|
||||
if key in task.params:
|
||||
@@ -158,4 +158,4 @@ def normalize_task_report(task: Task) -> TaskReport:
|
||||
)
|
||||
# #endregion normalize_task_report
|
||||
|
||||
# #endregion normalizer
|
||||
# #endregion normalizer
|
||||
|
||||
Reference in New Issue
Block a user