Make mypy as strict as practical #13
2 changed files with 7 additions and 8 deletions
Turn the ORM Base into a real class
commit
6633067563
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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",
|
||||
},
|
||||
),
|
||||
)
|
||||
)
|
||||
|
|
|
|||
Loading…
Reference in a new issue