fix(mypy): narrow legacy approval task_id before dict key
This commit is contained in:
@@ -196,10 +196,11 @@ async def pending_approval_conflicts_by_task(
|
|||||||
legacy_statement = legacy_statement.where(col(Approval.id) != exclude_approval_id)
|
legacy_statement = legacy_statement.where(col(Approval.id) != exclude_approval_id)
|
||||||
legacy_rows = list(await session.exec(legacy_statement))
|
legacy_rows = list(await session.exec(legacy_statement))
|
||||||
|
|
||||||
for legacy_task_id, approval_id, _created_at in legacy_rows:
|
for legacy_task_id_opt, approval_id, _created_at in legacy_rows:
|
||||||
if legacy_task_id is None:
|
if legacy_task_id_opt is None:
|
||||||
continue
|
continue
|
||||||
conflicts.setdefault(legacy_task_id, approval_id)
|
# mypy: SQL rows can include NULL task_id; guard before using as dict[UUID, UUID] key.
|
||||||
|
conflicts.setdefault(legacy_task_id_opt, approval_id)
|
||||||
|
|
||||||
return conflicts
|
return conflicts
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user