From b7d204dbb0caa4ee6e91d8fc9027f45ae7b194d8 Mon Sep 17 00:00:00 2001 From: Stephen McMurtry Date: Fri, 2 Jun 2023 20:18:33 +0000 Subject: [PATCH] adding the correct types to models.py --- app/db_type.py | 2 ++ app/models.py | 6 ++++-- 2 files changed, 6 insertions(+), 2 deletions(-) create mode 100644 app/db_type.py diff --git a/app/db_type.py b/app/db_type.py new file mode 100644 index 0000000000..46ae35b2d4 --- /dev/null +++ b/app/db_type.py @@ -0,0 +1,2 @@ +from sqlalchemy import * # noqa: F401,F403 +from sqlalchemy.orm import * # noqa: F401,F403 diff --git a/app/models.py b/app/models.py index 05ce3a5e2c..2491ec9e12 100644 --- a/app/models.py +++ b/app/models.py @@ -2,7 +2,7 @@ import itertools import uuid from enum import Enum -from typing import Any, Iterable, Literal, Optional +from typing import Any, Iterable, Literal, Optional, cast from flask import current_app, url_for from flask_sqlalchemy.model import DefaultMeta @@ -33,6 +33,7 @@ from app import ( DATETIME_FORMAT, db, + db_type, signer_api_key, signer_bearer_token, signer_inbound_sms, @@ -50,6 +51,7 @@ TEMPLATE_TYPES = [SMS_TYPE, EMAIL_TYPE, LETTER_TYPE] +db = cast(db_type, db) # type: ignore template_types = db.Enum(*TEMPLATE_TYPES, name="template_type") NORMAL = "normal" @@ -88,7 +90,7 @@ def update_from_original(self, original): current_app.logger.debug("{} has no column {} to copy from".format(original, c.name)) -BaseModel: DefaultMeta = db.Model +BaseModel: DefaultMeta = db.Model # type: ignore class User(BaseModel):