Make mypy as strict as practical #13

Merged
alexander merged 32 commits from stricter-mypy into develop 2026-12-01 14:26:52 +01:00
2 changed files with 4 additions and 1 deletions
Showing only changes of commit 7190724260 - Show all commits

Enable the "possibly-undefined" error code

Alexander Hess 2026-12-01 13:11:32 +01:00
Signed by: alexander
GPG key ID: B46EDB4DFC26805D

View file

@ -476,6 +476,8 @@ enable_error_code = [
"ignore-without-code",
# Report overrides of mutable attributes with incompatible types
"mutable-override",
# Report variables that may be used before they are assigned
"possibly-undefined",
]
# Check further edge cases that are rarely an issue in practice

View file

@ -36,9 +36,10 @@ def gridify() -> None: # pragma: no cover note:b1f68d24
# Because the number of assigned addresses is the same across
# different `side_length`s, we can take the last `grid` from the `city`.
last_grid_id = grid.id # type: ignore[possibly-undefined]
n_assigned = (
db.session.query(db.AddressPixelAssociation)
.filter(db.AddressPixelAssociation.grid_id == grid.id)
.filter(db.AddressPixelAssociation.grid_id == last_grid_id)
.count()
)
click.echo(