Type hint fixes

This commit is contained in:
Edward Betts 2023-11-09 07:40:37 +01:00
parent 441839e832
commit e1d5f33d2e

6
app.py
View file

@ -23,7 +23,7 @@ from flask import (
session, session,
url_for, url_for,
) )
from requests_oauthlib import OAuth1Session from requests_oauthlib import OAuth1Session # type: ignore
from sqlalchemy import distinct, func from sqlalchemy import distinct, func
from sqlalchemy.orm import aliased from sqlalchemy.orm import aliased
from sqlalchemy.sql.expression import desc from sqlalchemy.sql.expression import desc
@ -119,7 +119,7 @@ def shutdown_session(exception: Exception | None = None) -> None:
def set_url_args(endpoint: str | None = None, **new_args: str) -> str: def set_url_args(endpoint: str | None = None, **new_args: str) -> str:
if endpoint is None: if endpoint is None:
endpoint = request.endpoint endpoint = request.endpoint
assert endpoint and request.view_args assert endpoint and request.view_args is not None
args = request.view_args.copy() args = request.view_args.copy()
args.update(request.args) args.update(request.args)
args.update(new_args) args.update(new_args)
@ -496,7 +496,7 @@ def item_page(item_id: int) -> str | Response:
label_languages = label_and_language["languages"] if label_and_language else [] label_languages = label_and_language["languages"] if label_and_language else []
show_translation_links = all(lang.code != "en" for lang in label_languages) show_translation_links = all(lang.code != "en" for lang in label_languages)
artwork_item = Item.query.get(item_id) # type: ignore artwork_item = Item.query.get(item_id)
if artwork_item is None: if artwork_item is None:
if not wdqs.is_artificial_physical_object(qid): if not wdqs.is_artificial_physical_object(qid):
return render_template( return render_template(