Jun-17-2020, 06:52 PM
Just for future reference, what I decided to do was this:
models.py
from typing import Type, Union TableTypes = Union[Type['M1'], Type['M2'], ..., Type['M20']] class M1(db.Model): ... class M2(db.Model): ... ... class M20(db.Model): ...Then wherever you need type hints you can use it like:
import models as m def func(table: m.TableTypes) -> bool ... return TrueNow it's more clean and
mypy
is not screaming anymore! =)