code-to10 v6 A6: fix mypy cost.py:551 tuple annotation

- model_breakdown inferred params as a 1-tuple from the first
  branch, so params + (month,) was tuple[Any] vs tuple[Any, str].
  Annotate params as bare tuple (tuple[Any, ...]) before branching.
- Annotation only: the () initializer is never used (if/elif/else
  always overwrites it), runtime semantics unchanged.
- mypy cloud/: 0 errors in 94 files (was 1 error); ruff clean;
  cost tests 39 pass.

(cherry picked from commit a9fd0692361e8169554413b725c81135be2c5525)
This commit is contained in:
host committed 2026-11-03 02:49:26 +00:00
1 parent ee8d1e1e28
commit c33bfd240e
1 file changed
+6
+6
View File
@@ -536,6 +536,12 @@ class CostStore:
raise ValueError(
"exactly one of task_id, project_id, creator_id required")
join = ""
# 类型标注而已(A6):首分支会把 params 推断成单元素元组,
# 导致下面 params + (month,) 报 tuple[Any] vs tuple[Any, str];
# 标注成裸 tuple(即 tuple[Any, ...])后三分支与拼接均合法。
# 初值 () 永不被使用——if/elif/else 三分支必居其一重写它,
# 运行时语义不变。
params: tuple = ()
if task_id is not None:
where, params = "c.task_id = ?", (task_id,)
elif project_id is not None: