Skip to content

Commit

Permalink
Update mypy from ~=1.4.1 to ~=1.5.1, django-stubs from ~=4.2.0 to ~=4…
Browse files Browse the repository at this point in the history
….2.4 (#2003)
  • Loading branch information
dependabot[bot] authored Sep 10, 2023
1 parent 31c1ca4 commit e7766cc
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions evap/evaluation/models_logging.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
4 changes: 2 additions & 2 deletions evap/evaluation/tests/test_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion evap/staff/importers/enrollment.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
]
Expand Down
4 changes: 2 additions & 2 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit e7766cc

Please sign in to comment.