diff --git a/install/crm/cidoc_rtfs_parser.py b/install/crm/cidoc_rtfs_parser.py index 83d1bb946..54e8a9892 100644 --- a/install/crm/cidoc_rtfs_parser.py +++ b/install/crm/cidoc_rtfs_parser.py @@ -30,7 +30,7 @@ # import time -from typing import Dict, List, Optional +from typing import Any, Dict, List, Optional import psycopg2.extras from rdflib import URIRef @@ -50,7 +50,7 @@ DATABASE_PASS = 'CHANGE ME' -def connect() -> psycopg2.connect: +def connect() -> Any: return psycopg2.connect( database=DATABASE_NAME, user=DATABASE_USER, @@ -89,11 +89,16 @@ def import_cidoc() -> None: except Exception: print(f'Not able to parse subject: {subject}') continue - item = Item(code, name.replace('_', ' '), graph.comment(subject)) + item = Item( + code, + name.replace('_', ' '), + graph.comment(subject)) # type: ignore # Translations for language in ['de', 'en', 'fr', 'ru', 'el', 'pt', 'zh']: - translation = graph.preferredLabel(subject, lang=language) + translation = graph.preferredLabel( + subject, + lang=language) # type: ignore if translation and translation[0][1]: item.label[language] = translation[0][1] diff --git a/openatlas/__init__.py b/openatlas/__init__.py index 412d8e304..709a0a84e 100644 --- a/openatlas/__init__.py +++ b/openatlas/__init__.py @@ -1,5 +1,5 @@ import locale -from typing import Optional +from typing import Any, Optional from flask import Flask, Response, g, request, session from flask_babel import Babel @@ -109,5 +109,5 @@ def apply_caching(response: Response) -> Response: @app.teardown_request -def teardown_request(_exception: Optional[Exception]) -> None: +def teardown_request(_exception: Optional[Any]) -> None: close_connection() diff --git a/openatlas/database/settings.py b/openatlas/database/settings.py index 4e572f845..d33f986e5 100644 --- a/openatlas/database/settings.py +++ b/openatlas/database/settings.py @@ -9,8 +9,7 @@ class Settings: @staticmethod def get_settings( cursor: Optional[DictCursor] = None) -> dict[str, str]: - if not cursor: - cursor = g.cursor + cursor = cursor or g.cursor cursor.execute("SELECT name, value FROM web.settings;") return {row['name']: row['value'] for row in cursor.fetchall()} diff --git a/openatlas/display/util.py b/openatlas/display/util.py index b6d687a99..8c397cc6f 100644 --- a/openatlas/display/util.py +++ b/openatlas/display/util.py @@ -632,7 +632,7 @@ def uc_first(string: str) -> str: @app.template_filter() -def display_info(data: dict[str, Union[str, list[str]]]) -> str: +def display_info(data: dict[str, Any]) -> str: return render_template('util/info_data.html', data=data) @@ -785,7 +785,7 @@ def get_iiif_file_path(id_: int) -> Path: def convert_image_to_iiif(id_: int) -> None: - command = ["vips" if os.name == 'posix' else "vips.exe"] + command: list[Any] = ["vips" if os.name == 'posix' else "vips.exe"] command.extend([ 'tiffsave', get_file_path(id_), diff --git a/openatlas/forms/process.py b/openatlas/forms/process.py index 032c95440..0892137d0 100644 --- a/openatlas/forms/process.py +++ b/openatlas/forms/process.py @@ -129,9 +129,13 @@ def process_origin(manager: Any) -> None: def process_dates(manager: Any) -> dict[str, Any]: - data = { - 'begin_from': None, 'begin_to': None, 'begin_comment': None, - 'end_from': None, 'end_to': None, 'end_comment': None} + data: dict[str, Any] = { + 'begin_from': None, + 'begin_to': None, + 'begin_comment': None, + 'end_from': None, + 'end_to': None, + 'end_comment': None} form = manager.form if hasattr(form, 'begin_year_from') and form.begin_year_from.data: data['begin_comment'] = form.begin_comment.data diff --git a/openatlas/forms/validation.py b/openatlas/forms/validation.py index e54eabf70..0d263fdb0 100644 --- a/openatlas/forms/validation.py +++ b/openatlas/forms/validation.py @@ -3,18 +3,18 @@ from flask import g, request from flask_babel import lazy_gettext as _ from flask_wtf import FlaskForm -from wtforms import MultipleFileField +from wtforms import MultipleFileField, validators +from openatlas.display.util import uc_first from openatlas.forms.field import TreeField from openatlas.forms.util import form_to_datetime64 from openatlas.models.entity import Entity from openatlas.models.type import Type -from openatlas.display.util import uc_first def file(_form: FlaskForm, field: MultipleFileField) -> None: for file_ in request.files.getlist('file'): - if not file_ or Path(file_.filename).suffix[1:] not in \ + if not file_ or Path(str(file_.filename)).suffix[1:] not in \ g.settings['file_upload_allowed_extension']: field.errors.append(_('file type not allowed')) @@ -26,7 +26,7 @@ def hierarchy_name_exists(form: FlaskForm, field: TreeField) -> None: field.errors.append(_('error name exists')) -def validate(form: FlaskForm, extra_validators=None) -> bool: +def validate(form: FlaskForm, extra_validators: validators = None) -> bool: valid = FlaskForm.validate(form) if hasattr(form, 'begin_year_from'): # Dates if not validate_dates(form): diff --git a/openatlas/models/export.py b/openatlas/models/export.py index 37e4d1f51..bf361b04a 100644 --- a/openatlas/models/export.py +++ b/openatlas/models/export.py @@ -19,7 +19,8 @@ def sql_export(format_: str, postfix: Optional[str] = '') -> bool: file = app.config['EXPORT_PATH'] \ / f'{current_date_for_filename()}_export{postfix}.{format_}' command: Any = [ - "pg_dump" if os.name == 'posix' else Path(shutil.which("pg_dump.exe"))] + "pg_dump" if os.name == 'posix' + else Path(str(shutil.which("pg_dump.exe")))] if format_ == 'dump': command.append('-Fc') command.extend([ diff --git a/openatlas/views/admin.py b/openatlas/views/admin.py index d278cc017..c3ac00a72 100644 --- a/openatlas/views/admin.py +++ b/openatlas/views/admin.py @@ -152,12 +152,11 @@ def admin_index( button(_('system log'), url_for('admin_log'))]) tabs['email'] = Tab( 'email', - display_info(get_form_settings(MailForm())), + display_info(get_form_settings(MailForm())) + + (display_form(form) if g.settings['mail'] else ''), buttons=[ manual('admin/mail'), button(_('edit'), url_for('admin_settings', category='mail'))]) - if g.settings['mail']: - tabs['email'].content += display_form(form) tabs['IIIF'] = Tab( 'IIIF', display_info(get_form_settings(IiifForm())), diff --git a/openatlas/views/entity.py b/openatlas/views/entity.py index aae056164..fb7115d15 100644 --- a/openatlas/views/entity.py +++ b/openatlas/views/entity.py @@ -198,7 +198,7 @@ def check_update_access(entity: Entity) -> None: abort(403) -def insert_files(manager: BaseManager) -> Union[str, Response]: +def insert_files(manager: BaseManager) -> str: filenames = [] try: Transaction.begin() @@ -235,7 +235,7 @@ def insert_files(manager: BaseManager) -> Union[str, Response]: return url -def save(manager: BaseManager) -> Union[str, Response]: +def save(manager: BaseManager) -> str: Transaction.begin() action = 'update' if manager.entity else 'insert' try: diff --git a/openatlas/views/imports.py b/openatlas/views/imports.py index 02b166528..c90b44908 100644 --- a/openatlas/views/imports.py +++ b/openatlas/views/imports.py @@ -9,8 +9,8 @@ from flask_wtf import FlaskForm from werkzeug.utils import redirect, secure_filename from werkzeug.wrappers import Response -from wtforms import BooleanField, FileField, StringField, TextAreaField -from wtforms.validators import InputRequired +from wtforms import ( + BooleanField, FileField, StringField, TextAreaField, validators) from openatlas import app from openatlas.database.connect import Transaction @@ -29,12 +29,12 @@ class ProjectForm(FlaskForm): project_id: Optional[int] = None name = StringField( _('name'), - [InputRequired()], + [validators.InputRequired()], render_kw={'autofocus': True}) description = TextAreaField(_('description')) save = SubmitField(_('insert')) - def validate(self, extra_validators=None) -> bool: + def validate(self, extra_validators: validators = None) -> bool: valid = FlaskForm.validate(self) name = Import.get_project_by_id(self.project_id).name \ if self.project_id else '' @@ -171,14 +171,14 @@ def import_project_delete(id_: int) -> Response: class ImportForm(FlaskForm): - file = FileField(_('file'), [InputRequired()]) + file = FileField(_('file'), [validators.InputRequired()]) preview = BooleanField(_('preview only'), default=True) duplicate = BooleanField(_('check for duplicates'), default=True) save = SubmitField(_('import')) - def validate(self, extra_validators=None) -> bool: + def validate(self, extra_validators: validators=None) -> bool: valid = FlaskForm.validate(self) - if pathlib.Path(request.files['file'].filename) \ + if pathlib.Path(str(request.files['file'].filename)) \ .suffix.lower() != '.csv': self.file.errors.append(_('file type not allowed')) valid = False @@ -197,7 +197,8 @@ def import_data(project_id: int, class_: str) -> str: class_label = g.classes[class_].label if form.validate_on_submit(): file_ = request.files['file'] - file_path = app.config['TMP_PATH'] / secure_filename(file_.filename) + file_path = \ + app.config['TMP_PATH'] / secure_filename(str(file_.filename)) columns: dict[str, list[str]] = { 'allowed': ['name', 'id', 'description'], 'valid': [], diff --git a/openatlas/views/profile.py b/openatlas/views/profile.py index 5bc85a305..39566546f 100644 --- a/openatlas/views/profile.py +++ b/openatlas/views/profile.py @@ -8,7 +8,7 @@ from flask_wtf import FlaskForm from werkzeug.utils import redirect from werkzeug.wrappers import Response -from wtforms import BooleanField, PasswordField +from wtforms import BooleanField, PasswordField, validators from wtforms.validators import InputRequired from openatlas import app @@ -29,7 +29,7 @@ class PasswordForm(FlaskForm): show_passwords = BooleanField(_('show passwords')) save = SubmitField(_('save')) - def validate(self, extra_validators=None) -> bool: + def validate(self, extra_validators: validators = None) -> bool: valid = FlaskForm.validate(self) hash_ = bcrypt.hashpw( self.password_old.data.encode('utf-8'), diff --git a/openatlas/views/search.py b/openatlas/views/search.py index 03015fb68..6267b0be9 100644 --- a/openatlas/views/search.py +++ b/openatlas/views/search.py @@ -1,8 +1,11 @@ +from typing import Any + from flask import g, render_template, request from flask_babel import lazy_gettext as _ from flask_wtf import FlaskForm from wtforms import ( - BooleanField, IntegerField, SelectMultipleField, StringField, widgets) + BooleanField, IntegerField, SelectMultipleField, StringField, validators, + widgets) from wtforms.validators import InputRequired, NoneOf, NumberRange, Optional from openatlas import app @@ -54,7 +57,7 @@ class SearchForm(FlaskForm): validators=validator_day) include_dateless = BooleanField(_('Include dateless entities')) - def validate(self, extra_validators=None) -> bool: + def validate(self, extra_validators: validators = None) -> bool: valid = FlaskForm.validate(self) from_date = form_to_datetime64( self.begin_year.data, diff --git a/openatlas/views/tools.py b/openatlas/views/tools.py index 4a0fb4535..70a9aa84a 100755 --- a/openatlas/views/tools.py +++ b/openatlas/views/tools.py @@ -197,7 +197,8 @@ def carbon(id_: int) -> Union[str, Response]: buttons.append( button(_('edit'), url_for('carbon_update', id_=entity.id))) if link_ := get_carbon_link(entity): - buttons.append(remove_link(_('radiocarbon dating'), link_, entity)) + buttons.append( + str(remove_link(_('radiocarbon dating'), link_, entity))) return render_template( 'tabs.html', entity=entity, diff --git a/openatlas/views/user.py b/openatlas/views/user.py index ab3869528..3fcefa357 100644 --- a/openatlas/views/user.py +++ b/openatlas/views/user.py @@ -9,7 +9,7 @@ from werkzeug.wrappers import Response from wtforms import ( BooleanField, HiddenField, PasswordField, SelectField, StringField, - TextAreaField) + TextAreaField, validators) from wtforms.validators import Email, InputRequired from openatlas import app @@ -43,7 +43,7 @@ class UserForm(FlaskForm): insert_and_continue = SubmitField(_('insert and continue')) continue_ = HiddenField() - def validate(self, extra_validators=None) -> bool: + def validate(self, extra_validators: validators = None) -> bool: valid = FlaskForm.validate(self) username = '' user_email = '' @@ -110,7 +110,7 @@ def user_activity(user_id: int = 0) -> str: entity = Entity.get_by_id(row['entity_id']) entity_name = link(entity) except AttributeError: # Entity already deleted - entity = None # type: ignore + entity = None entity_name = f"id {row['entity_id']}" user = User.get_by_id(row['user_id']) table.rows.append([ diff --git a/tests/base.py b/tests/base.py index 4c87c16cb..840729478 100644 --- a/tests/base.py +++ b/tests/base.py @@ -22,7 +22,7 @@ def setUp(self) -> None: url_for('login'), data={'username': 'Alice', 'password': 'test'}) with app.test_request_context(): - app.preprocess_request() # type: ignore + app.preprocess_request() self.alice_id = 2 self.precision_type = \ Type.get_hierarchy('External reference match') diff --git a/tests/test_actor.py b/tests/test_actor.py index dafb4a862..e95162fa9 100644 --- a/tests/test_actor.py +++ b/tests/test_actor.py @@ -11,7 +11,7 @@ class ActorTests(TestBaseCase): def test_actor(self) -> None: with app.app_context(): with app.test_request_context(): - app.preprocess_request() # type: ignore + app.preprocess_request() place = insert('place', 'Vienna') event = insert('acquisition', 'Event Horizon') group = insert('group', 'LV-426 colony') @@ -145,7 +145,7 @@ def test_actor(self) -> None: assert b'Ripley' in rv.data with app.test_request_context(): - app.preprocess_request() # type: ignore + app.preprocess_request() link_ = group.get_links('P107')[0] rv = self.app.get( diff --git a/tests/test_admin.py b/tests/test_admin.py index cf71db6bc..b727f173d 100644 --- a/tests/test_admin.py +++ b/tests/test_admin.py @@ -4,6 +4,7 @@ from openatlas import app from openatlas.database.entity import Entity +from openatlas.forms.util import form_to_datetime64 from openatlas.models.link import Link from tests.base import TestBaseCase, get_hierarchy, insert @@ -13,7 +14,7 @@ class AdminTests(TestBaseCase): def test_admin(self) -> None: with app.app_context(): with app.test_request_context(): - app.preprocess_request() # type: ignore + app.preprocess_request() person = insert('person', 'Oliver Twist') insert('person', 'Oliver Twist') insert('file', 'Forsaken file') @@ -70,16 +71,16 @@ def test_admin(self) -> None: assert b'An error occurred when trying to delete' in rv.data with app.test_request_context(): - app.preprocess_request() # type: ignore + app.preprocess_request() event = insert('acquisition', 'Event Horizon') person.update({ 'attributes': { 'begin_from': '2018-01-31', 'begin_to': '2018-01-01'}}) involvement = Link.get_by_id(event.link('P11', person)[0]) - involvement.begin_from = '2017-01-31' - involvement.begin_to = '2017-01-01' - involvement.end_from = '2017-01-01' + involvement.begin_from = form_to_datetime64(2017, 1, 31) + involvement.begin_to = form_to_datetime64(2017, 1, 1) + involvement.end_from = form_to_datetime64(2017, 1, 1) involvement.update() source = insert('source', 'Tha source') source.link('P67', event) diff --git a/tests/test_api.py b/tests/test_api.py index bab1a5957..a6c04a4dc 100644 --- a/tests/test_api.py +++ b/tests/test_api.py @@ -41,7 +41,7 @@ def test_api(self) -> None: with app.app_context(): with app.test_request_context(): - app.preprocess_request() # type: ignore + app.preprocess_request() for entity in get_by_cidoc_classes(['all']): if entity.name == 'Location of Shire': location = entity diff --git a/tests/test_artifact.py b/tests/test_artifact.py index ecce2a948..46e008d55 100644 --- a/tests/test_artifact.py +++ b/tests/test_artifact.py @@ -11,7 +11,7 @@ class ArtifactTest(TestBaseCase): def test_artifact(self) -> None: with app.app_context(): with app.test_request_context(): - app.preprocess_request() # type: ignore + app.preprocess_request() source = insert('source', 'Necronomicon') actor = insert('person', 'Conan') place = insert('place', 'Home') diff --git a/tests/test_event.py b/tests/test_event.py index ce11a30a3..2ce99c36a 100644 --- a/tests/test_event.py +++ b/tests/test_event.py @@ -11,7 +11,7 @@ class EventTest(TestBaseCase): def test_event(self) -> None: with app.app_context(): with app.test_request_context(): - app.preprocess_request() # type: ignore + app.preprocess_request() place_name = 'Lewis and Clark' actor_name = 'Captain Miller' actor = insert('person', actor_name) diff --git a/tests/test_file.py b/tests/test_file.py index a585010fd..df92b0b8c 100644 --- a/tests/test_file.py +++ b/tests/test_file.py @@ -13,7 +13,7 @@ class FileTest(TestBaseCase): def test_file(self) -> None: with app.app_context(): with app.test_request_context(): - app.preprocess_request() # type: ignore + app.preprocess_request() place = insert('place', 'File keeper') reference = insert('edition', 'Ancient Books') @@ -35,7 +35,7 @@ def test_file(self) -> None: assert b'An entry has been created' in rv.data with app.test_request_context(): - app.preprocess_request() # type: ignore + app.preprocess_request() files = Entity.get_by_class('file') file_id = files[0].id @@ -137,7 +137,7 @@ def test_file(self) -> None: assert bool(str(file_id) in rv['@id']) with app.test_request_context(): - app.preprocess_request() # type: ignore + app.preprocess_request() files[0].link('P2', g.types[get_hierarchy('License').subs[0]]) rv = self.app.get(url_for('api.licensed_file_overview')) diff --git a/tests/test_image.py b/tests/test_image.py index abd79404e..f09f48fb0 100644 --- a/tests/test_image.py +++ b/tests/test_image.py @@ -16,7 +16,7 @@ def test_image(self) -> None: app.config['IMAGE_SIZE']['tmp'] = '1' with app.app_context(): with app.test_request_context(): - app.preprocess_request() # type: ignore + app.preprocess_request() place = insert('place', 'Nostromos') # Resizing through UI insert @@ -29,7 +29,7 @@ def test_image(self) -> None: assert b'An entry has been created' in rv.data with app.test_request_context(): - app.preprocess_request() # type: ignore + app.preprocess_request() files = Entity.get_by_class('file') file_id = files[0].id @@ -44,7 +44,7 @@ def test_image(self) -> None: assert b'The entry has been deleted' in rv.data with app.test_request_context(): - app.preprocess_request() # type: ignore + app.preprocess_request() file_pathless = insert('file', 'Pathless_File') file = insert('file', 'Test_File') file.link('P2', g.types[get_hierarchy('License').subs[0]]) diff --git a/tests/test_involvement.py b/tests/test_involvement.py index 9e3202306..b21e30128 100644 --- a/tests/test_involvement.py +++ b/tests/test_involvement.py @@ -9,7 +9,7 @@ class InvolvementTests(TestBaseCase): def test_involvement(self) -> None: with app.app_context(): with app.test_request_context(): - app.preprocess_request() # type: ignore + app.preprocess_request() actor = insert('person', 'Captain Miller') event = insert('acquisition', 'Event Horizon') @@ -53,7 +53,7 @@ def test_involvement(self) -> None: assert b'Event Horizon' in rv.data with app.test_request_context(): - app.preprocess_request() # type: ignore + app.preprocess_request() link_ = event.get_links('P22')[0] rv = self.app.post( diff --git a/tests/test_model.py b/tests/test_model.py index f79264370..be4047700 100644 --- a/tests/test_model.py +++ b/tests/test_model.py @@ -27,7 +27,7 @@ def test_model(self) -> None: assert b'Wrong domain' in rv.data with app.test_request_context(): - app.preprocess_request() # type: ignore + app.preprocess_request() actor = insert('person', 'King Arthur') event = insert('activity', 'Battle of Camlann') event.link('P11', actor) diff --git a/tests/test_note.py b/tests/test_note.py index b3a1ddb01..e3879b32b 100644 --- a/tests/test_note.py +++ b/tests/test_note.py @@ -10,7 +10,7 @@ class NoteTest(TestBaseCase): def test_note(self) -> None: with app.app_context(): with app.test_request_context(): - app.preprocess_request() # type: ignore + app.preprocess_request() actor = insert('person', 'Ripley') rv = self.app.get(url_for('note_insert', entity_id=actor.id)) @@ -26,7 +26,7 @@ def test_note(self) -> None: assert b'A nice description' in rv.data with app.test_request_context(): - app.preprocess_request() # type: ignore + app.preprocess_request() note_id = User.get_notes_by_user_id(self.alice_id)[0]['id'] rv = self.app.get(url_for('note_update', id_=note_id)) diff --git a/tests/test_place.py b/tests/test_place.py index f7a17a97b..20574216a 100644 --- a/tests/test_place.py +++ b/tests/test_place.py @@ -14,7 +14,7 @@ class PlaceTest(TestBaseCase): def test_place(self) -> None: with app.app_context(): with app.test_request_context(): - app.preprocess_request() # type: ignore + app.preprocess_request() reference = insert('external_reference', 'https://d-nb.info') source = insert('source', 'Necronomicon') @@ -72,7 +72,7 @@ def test_place(self) -> None: assert b'Necronomicon' in rv.data with app.test_request_context(): - app.preprocess_request() # type: ignore + app.preprocess_request() places = Entity.get_by_class('place') place = places[0] place2 = places[1] @@ -128,7 +128,7 @@ def test_place(self) -> None: assert b'An entry has been created' in rv.data with app.test_request_context(): - app.preprocess_request() # type: ignore + app.preprocess_request() file = Entity.get_by_class('file')[0] link_id = file.link('P67', place)[0] @@ -158,7 +158,7 @@ def test_place(self) -> None: assert b'Edit' in rv.data with app.test_request_context(): - app.preprocess_request() # type: ignore + app.preprocess_request() overlay = Overlay.get_by_object(place) overlay_id = overlay[list(overlay.keys())[0]].id diff --git a/tests/test_reference.py b/tests/test_reference.py index 8d7b19593..d5bcbfd3f 100644 --- a/tests/test_reference.py +++ b/tests/test_reference.py @@ -11,7 +11,7 @@ class ReferenceTest(TestBaseCase): def test_reference(self) -> None: with app.app_context(): with app.test_request_context(): - app.preprocess_request() # type: ignore + app.preprocess_request() batman = insert('person', 'Batman') rv: Any = self.app.post( @@ -35,7 +35,7 @@ def test_reference(self) -> None: assert b'https://d-nb.info' in rv.data with app.test_request_context(): - app.preprocess_request() # type: ignore + app.preprocess_request() link_id = batman.get_links('P67', True)[0].id rv = self.app.post( diff --git a/tests/test_relation.py b/tests/test_relation.py index 80c7be55c..2032ec635 100644 --- a/tests/test_relation.py +++ b/tests/test_relation.py @@ -9,7 +9,7 @@ class RelationTests(TestBaseCase): def test_relation(self) -> None: with app.app_context(): with app.test_request_context(): - app.preprocess_request() # type: ignore + app.preprocess_request() actor = insert('person', 'Connor MacLeod') related = insert('person', 'The Kurgan') @@ -48,7 +48,7 @@ def test_relation(self) -> None: assert b'The Kurgan' in rv.data with app.test_request_context(): - app.preprocess_request() # type: ignore + app.preprocess_request() link_ = actor.get_links('OA7')[0] rv = self.app.post( diff --git a/tests/test_search.py b/tests/test_search.py index dd7faa84e..e6221e03a 100644 --- a/tests/test_search.py +++ b/tests/test_search.py @@ -9,7 +9,7 @@ class SearchTest(TestBaseCase): def test_search(self) -> None: with app.app_context(): with app.test_request_context(): - app.preprocess_request() # type: ignore + app.preprocess_request() person = insert('person', 'Waldo') person.update({'attributes': {'begin_to': '2018-01-01'}}) person.link('P1', insert('appellation', 'Waldo alias')) diff --git a/tests/test_source.py b/tests/test_source.py index e8916c175..8602a747a 100644 --- a/tests/test_source.py +++ b/tests/test_source.py @@ -11,7 +11,7 @@ class SourceTest(TestBaseCase): def test_source(self) -> None: with app.app_context(): with app.test_request_context(): - app.preprocess_request() # type: ignore + app.preprocess_request() gillian = insert('person', 'Gillian Anderson Gillian Anderson') artifact = insert('artifact', 'Artifact with inscription') reference = insert('external_reference', 'https://d-nb.info') diff --git a/tests/test_type.py b/tests/test_type.py index 5f077c98a..9da151009 100644 --- a/tests/test_type.py +++ b/tests/test_type.py @@ -11,7 +11,7 @@ class TypeTest(TestBaseCase): def test_type(self) -> None: with app.app_context(): with app.test_request_context(): - app.preprocess_request() # type: ignore + app.preprocess_request() actor_type = get_hierarchy('Actor relation') dimension_type = get_hierarchy('Dimensions') historical_type = get_hierarchy('Historical place') @@ -93,7 +93,7 @@ def test_type(self) -> None: sex = get_hierarchy('Sex') with app.test_request_context(): - app.preprocess_request() # type: ignore + app.preprocess_request() actor = insert('person', 'Connor MacLeod') actor.link('P2', g.types[sex.subs[0]]) @@ -110,7 +110,7 @@ def test_type(self) -> None: assert b'Forbidden' in rv.data with app.test_request_context(): - app.preprocess_request() # type: ignore + app.preprocess_request() actor.link('P2', g.types[sex.subs[1]]) rv = self.app.get(url_for('update', id_=actor.id)) @@ -136,7 +136,7 @@ def test_type(self) -> None: assert b'Warning' in rv.data with app.test_request_context(): - app.preprocess_request() # type: ignore + app.preprocess_request() actor.link('P74', location, type_id=actor_type.subs[0]) rv = self.app.get( diff --git a/tests/test_user.py b/tests/test_user.py index 7998eb658..3510a4e4a 100644 --- a/tests/test_user.py +++ b/tests/test_user.py @@ -83,7 +83,7 @@ def test_user(self) -> None: assert b'403 - Forbidden' in rv.data with app.test_request_context(): - app.preprocess_request() # type: ignore + app.preprocess_request() person = insert('person', 'Hugo') insert('activity', 'Event Horizon').link('P11', person)