Skip to content

Commit

Permalink
Update formatting and typing (#644)
Browse files Browse the repository at this point in the history
* Update formatting and typing

* Fix md icon reference so pyppeteer tests pass
  • Loading branch information
annehaley authored Mar 29, 2023
1 parent 056161c commit de0da65
Show file tree
Hide file tree
Showing 44 changed files with 30 additions and 63 deletions.
1 change: 0 additions & 1 deletion miqa/core/migrations/0001_default_site.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ def rollback_default_site(apps: StateApps, schema_editor: BaseDatabaseSchemaEdit


class Migration(migrations.Migration):

dependencies = [
# This is the final sites app migration
('sites', '0002_alter_domain_unique'),
Expand Down
1 change: 0 additions & 1 deletion miqa/core/migrations/0002_initial.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@


class Migration(migrations.Migration):

initial = True

dependencies = [
Expand Down
1 change: 0 additions & 1 deletion miqa/core/migrations/0003_image_paths_unique.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@


class Migration(migrations.Migration):

dependencies = [
('core', '0002_initial'),
]
Expand Down
1 change: 0 additions & 1 deletion miqa/core/migrations/0004_auto_20210601_1222.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@


class Migration(migrations.Migration):

dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('core', '0003_image_paths_unique'),
Expand Down
1 change: 0 additions & 1 deletion miqa/core/migrations/0005_auto_20210601_1512.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@


class Migration(migrations.Migration):

dependencies = [
('core', '0004_auto_20210601_1222'),
]
Expand Down
1 change: 0 additions & 1 deletion miqa/core/migrations/0006_auto_20210609_1551.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@


class Migration(migrations.Migration):

dependencies = [
('core', '0005_auto_20210601_1512'),
]
Expand Down
1 change: 0 additions & 1 deletion miqa/core/migrations/0007_add_initials.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@


class Migration(migrations.Migration):

dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('core', '0006_auto_20210609_1551'),
Expand Down
1 change: 0 additions & 1 deletion miqa/core/migrations/0008_optional_annotation_creator.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@


class Migration(migrations.Migration):

dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('core', '0007_add_initials'),
Expand Down
1 change: 0 additions & 1 deletion miqa/core/migrations/0009_session_lock_owner.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@


class Migration(migrations.Migration):

dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('core', '0008_optional_annotation_creator'),
Expand Down
1 change: 0 additions & 1 deletion miqa/core/migrations/0010_auto_20210812_1545.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@


class Migration(migrations.Migration):

dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('core', '0009_session_lock_owner'),
Expand Down
1 change: 0 additions & 1 deletion miqa/core/migrations/0011_session_archived.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@


class Migration(migrations.Migration):

dependencies = [
('core', '0010_auto_20210812_1545'),
]
Expand Down
1 change: 0 additions & 1 deletion miqa/core/migrations/0012_alter_experiment_lock_owner.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@


class Migration(migrations.Migration):

dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('core', '0011_session_archived'),
Expand Down
1 change: 0 additions & 1 deletion miqa/core/migrations/0013_evaluations.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ def default_evaluation_model_mapping():


class Migration(migrations.Migration):

replaces = [
('core', '0013_auto_20210917_1235'),
('core', '0014_evaluation'),
Expand Down
1 change: 0 additions & 1 deletion miqa/core/migrations/0014_rename_session_to_project.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ def migrate_sessions_to_projects(apps: StateApps, schema_editor: BaseDatabaseSch


class Migration(migrations.Migration):

dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('core', '0013_evaluations'),
Expand Down
1 change: 0 additions & 1 deletion miqa/core/migrations/0015_scan_image_relationship.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@


class Migration(migrations.Migration):

dependencies = [
('core', '0014_rename_session_to_project'),
]
Expand Down
1 change: 0 additions & 1 deletion miqa/core/migrations/0016_scan_decision.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@


class Migration(migrations.Migration):

dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('core', '0015_scan_image_relationship'),
Expand Down
1 change: 0 additions & 1 deletion miqa/core/migrations/0017_remove_site.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@


class Migration(migrations.Migration):

dependencies = [
('core', '0016_scan_decision'),
]
Expand Down
1 change: 0 additions & 1 deletion miqa/core/migrations/0018_image_to_frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@


class Migration(migrations.Migration):

dependencies = [
('core', '0017_remove_site'),
]
Expand Down
1 change: 0 additions & 1 deletion miqa/core/migrations/0019_unique_evaluation.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@


class Migration(migrations.Migration):

dependencies = [
('core', '0018_image_to_frame'),
]
Expand Down
1 change: 0 additions & 1 deletion miqa/core/migrations/0020_alter_project_options.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@


class Migration(migrations.Migration):

dependencies = [
('core', '0019_unique_evaluation'),
]
Expand Down
1 change: 0 additions & 1 deletion miqa/core/migrations/0021_update_qc_options.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@


class Migration(migrations.Migration):

dependencies = [
('core', '0020_alter_project_options'),
]
Expand Down
1 change: 0 additions & 1 deletion miqa/core/migrations/0022_project_global_import_export.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@


class Migration(migrations.Migration):

dependencies = [
('core', '0021_update_qc_options'),
]
Expand Down
1 change: 0 additions & 1 deletion miqa/core/migrations/0023_user_identified_artifacts.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@


class Migration(migrations.Migration):

dependencies = [
('core', '0022_project_global_import_export'),
]
Expand Down
1 change: 0 additions & 1 deletion miqa/core/migrations/0024_alter_frame_raw_path.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@


class Migration(migrations.Migration):

dependencies = [
('core', '0023_user_identified_artifacts'),
]
Expand Down
1 change: 0 additions & 1 deletion miqa/core/migrations/0025_globals_and_decisions.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@


class Migration(migrations.Migration):

dependencies = [
('core', '0024_alter_frame_raw_path'),
]
Expand Down
1 change: 0 additions & 1 deletion miqa/core/migrations/0026_frame_content.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@


class Migration(migrations.Migration):

dependencies = [
('core', '0025_globals_and_decisions'),
]
Expand Down
1 change: 0 additions & 1 deletion miqa/core/migrations/0027_experiment_lock_time.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@


class Migration(migrations.Migration):

dependencies = [
('core', '0026_frame_content'),
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@


class Migration(migrations.Migration):

dependencies = [
('core', '0027_experiment_lock_time'),
]
Expand Down
1 change: 0 additions & 1 deletion miqa/core/migrations/0029_project_email_recipients.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@


class Migration(migrations.Migration):

dependencies = [
('core', '0028_project_settings_optional_fields'),
]
Expand Down
1 change: 0 additions & 1 deletion miqa/core/migrations/0030_optional_scan_fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@


class Migration(migrations.Migration):

dependencies = [
('core', '0029_project_email_recipients'),
]
Expand Down
1 change: 0 additions & 1 deletion miqa/core/migrations/0030_project_s3_public.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@


class Migration(migrations.Migration):

dependencies = [
('core', '0029_project_email_recipients'),
]
Expand Down
1 change: 0 additions & 1 deletion miqa/core/migrations/0030_scan_subject_session.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@


class Migration(migrations.Migration):

dependencies = [
('core', '0029_project_email_recipients'),
]
Expand Down
1 change: 0 additions & 1 deletion miqa/core/migrations/0031_merge_20220414_1433.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@


class Migration(migrations.Migration):

dependencies = [
('core', '0030_optional_scan_fields'),
('core', '0030_project_s3_public'),
Expand Down
1 change: 0 additions & 1 deletion miqa/core/migrations/0032_merge_20220422_1716.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@


class Migration(migrations.Migration):

dependencies = [
('core', '0030_scan_subject_session'),
('core', '0031_merge_20220414_1433'),
Expand Down
1 change: 0 additions & 1 deletion miqa/core/migrations/0033_project_anatomy_orientation.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@


class Migration(migrations.Migration):

dependencies = [
('core', '0032_merge_20220422_1716'),
]
Expand Down
1 change: 0 additions & 1 deletion miqa/core/migrations/0034_CT_scan_type.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@


class Migration(migrations.Migration):

dependencies = [
('core', '0033_project_anatomy_orientation'),
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@


class Migration(migrations.Migration):

dependencies = [
('core', '0034_CT_scan_type'),
]
Expand Down
2 changes: 0 additions & 2 deletions miqa/core/rest/email.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@

class EmailView(APIView):
def post(self, request, format=None):

msg = EmailMultiAlternatives(
request.data['subject'],
request.data['body'],
Expand All @@ -24,7 +23,6 @@ def post(self, request, format=None):
)

for index, screenshot in enumerate(request.data['screenshots']):

# parse data uri to extract mime type and base64 data
# assumptions: mime type is image/jpeg or image/png
match = re.fullmatch(
Expand Down
4 changes: 3 additions & 1 deletion miqa/core/rest/experiment.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from datetime import timedelta

from django.contrib.auth.models import User
from django.db import transaction
from django.utils import timezone
Expand Down Expand Up @@ -136,7 +138,7 @@ def lock(self, request, pk=None):
)
and (
experiment.lock_time is None
or timezone.now() - experiment.lock_time < timezone.timedelta(minutes=5)
or timezone.now() - experiment.lock_time < timedelta(minutes=5)
)
):
raise LockContention()
Expand Down
2 changes: 1 addition & 1 deletion miqa/core/rest/permissions.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from functools import wraps
from typing import Union

from django.contrib.auth.models import User
from django.shortcuts import get_object_or_404
from django.utils.functional import wraps
from django.views.generic import View
from guardian.shortcuts import get_perms
from rest_framework import status
Expand Down
1 change: 0 additions & 1 deletion miqa/core/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,6 @@ def perform_import(import_dict):
new_scan_decisions.append(decision)
new_scans.append(scan_object)
for frame_number, frame_data in scan_data['frames'].items():

if frame_data['file_location']:
frame_object = Frame(
frame_number=frame_number,
Expand Down
4 changes: 2 additions & 2 deletions miqa/core/tests/pyppeteer/test_save_decisions.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ async def test_save_decisions_tier_1(

# confirm that the number of scans awaiting tier 2 review is 1;
# only the second scan does not have "Usable" as the latest decision
complete_span = await (page.waitForXPath('//span[contains(., "tier 2 review (")]'))
complete_span = await page.waitForXPath('//span[contains(., "tier 2 review (")]')
complete_text = (await page.evaluate('(element) => element.textContent', complete_span)).strip()
assert complete_text == 'needs tier 2 review (1)'

Expand Down Expand Up @@ -151,6 +151,6 @@ async def test_save_decisions_tier_2(
await page.waitFor(3_000)

# confirm that the number of complete scans is 2
complete_span = await (page.waitForXPath('//span[contains(., "complete (")]'))
complete_span = await page.waitForXPath('//span[contains(., "complete (")]')
complete_text = (await page.evaluate('(element) => element.textContent', complete_span)).strip()
assert complete_text == 'complete (2)'
2 changes: 1 addition & 1 deletion miqa/settings.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# flake8: noqa N802
from __future__ import annotations

from datetime import timedelta
from pathlib import Path

from composed_configuration import (
Expand All @@ -14,7 +15,6 @@
SmtpEmailMixin,
TestingBaseConfiguration,
)
from datetime import timedelta
from composed_configuration._configuration import _BaseConfiguration
from configurations import values

Expand Down
Loading

0 comments on commit de0da65

Please sign in to comment.