From e7766cc450bf57e434300176aeaa5f2401342463 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sun, 10 Sep 2023 10:22:25 +0000 Subject: [PATCH] Update mypy from ~=1.4.1 to ~=1.5.1, django-stubs from ~=4.2.0 to ~=4.2.4 (#2003) --- evap/evaluation/models_logging.py | 4 ++-- evap/evaluation/tests/test_tools.py | 4 ++-- evap/staff/importers/enrollment.py | 2 +- requirements-dev.txt | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/evap/evaluation/models_logging.py b/evap/evaluation/models_logging.py index f12f988f98..f9cd00332c 100644 --- a/evap/evaluation/models_logging.py +++ b/evap/evaluation/models_logging.py @@ -159,14 +159,14 @@ def _get_change_data(self, action_type: InstanceActionType): if created_value is not None } elif action_type == InstanceActionType.CHANGE: - old_dict = type(self).objects.get(pk=self.pk)._as_dict() + old_dict = type(self)._default_manager.get(pk=self.pk)._as_dict() changes = { field_name: {FieldActionType.VALUE_CHANGE: [old_value, self_dict[field_name]]} for field_name, old_value in old_dict.items() if old_value != self_dict[field_name] } elif action_type == InstanceActionType.DELETE: - old_dict = type(self).objects.get(pk=self.pk)._as_dict() + old_dict = type(self)._default_manager.get(pk=self.pk)._as_dict() changes = { field_name: {FieldActionType.INSTANCE_DELETE: [deleted_value]} for field_name, deleted_value in old_dict.items() diff --git a/evap/evaluation/tests/test_tools.py b/evap/evaluation/tests/test_tools.py index b084cd6572..ee5adfa764 100644 --- a/evap/evaluation/tests/test_tools.py +++ b/evap/evaluation/tests/test_tools.py @@ -67,7 +67,7 @@ def test_is_prefetched(self): baker.make(Contribution, evaluation=evaluation) def test_logic(cls: type[Model], pk: int, field: str) -> None: - instance = cls.objects.get(pk=pk) + instance = cls._default_manager.get(pk=pk) self.assertFalse(is_prefetched(instance, field)) prefetch_related_objects([instance], field) @@ -76,7 +76,7 @@ def test_logic(cls: type[Model], pk: int, field: str) -> None: instance.refresh_from_db(fields=[field]) self.assertFalse(is_prefetched(instance, field)) - instance = cls.objects.filter(pk=instance.pk).prefetch_related(field).get() + instance = cls._default_manager.filter(pk=instance.pk).prefetch_related(field).get() self.assertTrue(is_prefetched(instance, field)) test_logic(Evaluation, evaluation.pk, "contributions") # inverse foreign key diff --git a/evap/staff/importers/enrollment.py b/evap/staff/importers/enrollment.py index e7e6bda190..b251ac0148 100644 --- a/evap/staff/importers/enrollment.py +++ b/evap/staff/importers/enrollment.py @@ -553,7 +553,7 @@ def finalize(self) -> None: existing_participation_pairs = [ (participation.evaluation.course.name_en, participation.userprofile.email) # type: ignore - for participation in Evaluation.participants.through.objects.filter( + for participation in Evaluation.participants.through._default_manager.filter( evaluation__course__name_en__in=seen_evaluation_names, userprofile__email__in=seen_user_emails ).prefetch_related("userprofile", "evaluation__course") ] diff --git a/requirements-dev.txt b/requirements-dev.txt index 8b8e8bfe35..34f0bb4c46 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -2,12 +2,12 @@ black~=23.7.0 coverage[toml] django-debug-toolbar~=4.0 -django-stubs~=4.2.0 +django-stubs~=4.2.4 django-stubs-ext~=4.2.0 django-webtest~=1.9.10 isort~=5.12.0 model-bakery~=1.15.0 -mypy~=1.4.1 +mypy~=1.5.1 openpyxl-stubs~=0.1.25 pylint-django~=2.5.3 pylint~=2.17.1