Skip to content

Commit 8c4a101

Browse files
committed
fix(seed): type _with_id as Any so mypy sees the id assignment
Refs #1
1 parent 786144e commit 8c4a101

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

‎app/seed.py‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,9 @@ def _stable_id(table: str, slug: str, taken: set[int]) -> int:
7777
attempt += 1 # collision: rehash rather than fall back to a counter
7878

7979

80-
def _with_id(obj: SQLModel, taken: set[int]) -> SQLModel:
81-
obj.id = _stable_id(type(obj).__tablename__, obj.slug, taken) # type: ignore[attr-defined]
80+
def _with_id(obj: Any, taken: set[int]) -> Any:
81+
"""Stamp a slug-derived id. Every data model has ``slug``; none are typed alike."""
82+
obj.id = _stable_id(str(type(obj).__tablename__), obj.slug, taken)
8283
return obj
8384

8485

0 commit comments

Comments
 (0)