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 7 additions and 8 deletions
Showing only changes of commit 6633067563 - Show all commits

Turn the ORM Base into a real class

Alexander Hess 2026-12-01 09:43:23 +01:00
Signed by: alexander
GPG key ID: B46EDB4DFC26805D

View file

@ -449,8 +449,8 @@ disallow_any_generics = true
# Disallow functions with incomplete type annotations
disallow_incomplete_defs = true
# Allow subclassing `Any` as long as the ORM models' `Base` is untyped
disallow_subclassing_any = false
# Disallow subclassing classes typed `Any`
disallow_subclassing_any = true
# Disallow calling functions without type annotations ...
disallow_untyped_calls = true

View file

@ -1,15 +1,15 @@
"""Provide the ORM's declarative base."""
import typing as t
import sqlalchemy as sa
from sqlalchemy import orm
import velofy
Base: t.Any = orm.declarative_base(
metadata=sa.MetaData(
class Base(orm.DeclarativeBase):
"""The declarative base of all ORM models."""
metadata = sa.MetaData(
schema=velofy.config.CLEAN_SCHEMA,
naming_convention={
"pk": "pk_%(table_name)s",
@ -18,5 +18,4 @@ Base: t.Any = orm.declarative_base(
"ix": "ix_%(table_name)s_on_%(column_0_N_name)s",
"ck": "ck_%(table_name)s_on_%(constraint_name)s",
},
),
)
)