From 81dc5554a8ab9f4e23fdf62edd56c6a6599eb011 Mon Sep 17 00:00:00 2001 From: Jennifer Richards Date: Wed, 10 Jan 2024 11:53:43 -0400 Subject: [PATCH] test: unpin django-stubs and update mypy (#6901) * chore: Unpin django-stubs / update mypy * test: Use "app.model" for ManyToManyField django-stubs requires "app.model" instead of just "model" for ManyToManyField lazy model references. See https://github.com/typeddjango/django-stubs/issues/1802 --- ietf/doc/models.py | 2 +- ietf/ipr/models.py | 4 ++-- ietf/liaisons/models.py | 2 +- ietf/mailtrigger/models.py | 4 ++-- ietf/meeting/models.py | 2 +- ietf/name/models.py | 2 +- ietf/nomcom/models.py | 8 ++++---- requirements.txt | 5 ++--- 8 files changed, 14 insertions(+), 15 deletions(-) diff --git a/ietf/doc/models.py b/ietf/doc/models.py index e53717cb7d..536e3e3493 100644 --- a/ietf/doc/models.py +++ b/ietf/doc/models.py @@ -83,7 +83,7 @@ class State(models.Model): desc = models.TextField(blank=True) order = models.IntegerField(default=0) - next_states = models.ManyToManyField('State', related_name="previous_states", blank=True) + next_states = models.ManyToManyField('doc.State', related_name="previous_states", blank=True) def __str__(self): return self.name diff --git a/ietf/ipr/models.py b/ietf/ipr/models.py index a3c917747e..693f19abe9 100644 --- a/ietf/ipr/models.py +++ b/ietf/ipr/models.py @@ -16,11 +16,11 @@ class IprDisclosureBase(models.Model): by = ForeignKey(Person) # who was logged in, or System if nobody was logged in compliant = models.BooleanField("Complies to RFC3979", default=True) - docs = models.ManyToManyField(Document, through='IprDocRel') + docs = models.ManyToManyField(Document, through='ipr.IprDocRel') holder_legal_name = models.CharField(max_length=255) notes = models.TextField("Additional notes", blank=True) other_designations = models.CharField("Designations for other contributions", blank=True, max_length=255) - rel = models.ManyToManyField('self', through='RelatedIpr', symmetrical=False) + rel = models.ManyToManyField('self', through='ipr.RelatedIpr', symmetrical=False) state = ForeignKey(IprDisclosureStateName) submitter_name = models.CharField(max_length=255,blank=True) submitter_email = models.EmailField(blank=True) diff --git a/ietf/liaisons/models.py b/ietf/liaisons/models.py index 6302bea779..f357d6cf8c 100644 --- a/ietf/liaisons/models.py +++ b/ietf/liaisons/models.py @@ -44,7 +44,7 @@ class LiaisonStatement(models.Model): body = models.TextField(blank=True) tags = models.ManyToManyField(LiaisonStatementTagName, blank=True) - attachments = models.ManyToManyField(Document, through='LiaisonStatementAttachment', blank=True) + attachments = models.ManyToManyField(Document, through='liaisons.LiaisonStatementAttachment', blank=True) state = ForeignKey(LiaisonStatementState, default='pending') class Meta: diff --git a/ietf/mailtrigger/models.py b/ietf/mailtrigger/models.py index 1cf84033b3..aea530083a 100644 --- a/ietf/mailtrigger/models.py +++ b/ietf/mailtrigger/models.py @@ -36,8 +36,8 @@ def clean_duplicates(addrlist): class MailTrigger(models.Model): slug = models.CharField(max_length=64, primary_key=True) desc = models.TextField(blank=True) - to = models.ManyToManyField('Recipient', blank=True, related_name='used_in_to') - cc = models.ManyToManyField('Recipient', blank=True, related_name='used_in_cc') + to = models.ManyToManyField('mailtrigger.Recipient', blank=True, related_name='used_in_to') + cc = models.ManyToManyField('mailtrigger.Recipient', blank=True, related_name='used_in_cc') class Meta: ordering = ["slug"] diff --git a/ietf/meeting/models.py b/ietf/meeting/models.py index 20fa9cf1bb..11a9982283 100644 --- a/ietf/meeting/models.py +++ b/ietf/meeting/models.py @@ -569,7 +569,7 @@ class TimeSlot(models.Model): duration = models.DurationField(default=datetime.timedelta(0)) location = ForeignKey(Room, blank=True, null=True) show_location = models.BooleanField(default=True, help_text="Show location in agenda.") - sessions = models.ManyToManyField('Session', related_name='slots', through='SchedTimeSessAssignment', blank=True, help_text="Scheduled session, if any.") + sessions = models.ManyToManyField('meeting.Session', related_name='slots', through='meeting.SchedTimeSessAssignment', blank=True, help_text="Scheduled session, if any.") modified = models.DateTimeField(auto_now=True) # diff --git a/ietf/name/models.py b/ietf/name/models.py index 9bedd6cc2b..d4d53def87 100644 --- a/ietf/name/models.py +++ b/ietf/name/models.py @@ -101,7 +101,7 @@ class DraftSubmissionStateName(NameModel): """Uploaded, Awaiting Submitter Authentication, Awaiting Approval from Previous Version Authors, Awaiting Initial Version Approval, Awaiting Manual Post, Cancelled, Posted""" - next_states = models.ManyToManyField('DraftSubmissionStateName', related_name="previous_states", blank=True) + next_states = models.ManyToManyField('name.DraftSubmissionStateName', related_name="previous_states", blank=True) class RoomResourceName(NameModel): "Room resources: Audio Stream, Meetecho, . . ." class IprDisclosureStateName(NameModel): diff --git a/ietf/nomcom/models.py b/ietf/nomcom/models.py index 51006a227e..b514f4fb1f 100644 --- a/ietf/nomcom/models.py +++ b/ietf/nomcom/models.py @@ -148,7 +148,7 @@ class Nominee(models.Model): email = ForeignKey(Email) person = ForeignKey(Person, blank=True, null=True) - nominee_position = models.ManyToManyField('Position', through='NomineePosition') + nominee_position = models.ManyToManyField('nomcom.Position', through='nomcom.NomineePosition') duplicated = ForeignKey('Nominee', blank=True, null=True) nomcom = ForeignKey('NomCom') @@ -293,9 +293,9 @@ def get_description(self): class Feedback(models.Model): nomcom = ForeignKey('NomCom') author = models.EmailField(verbose_name='Author', blank=True) - positions = models.ManyToManyField('Position', blank=True) - nominees = models.ManyToManyField('Nominee', blank=True) - topics = models.ManyToManyField('Topic', blank=True) + positions = models.ManyToManyField('nomcom.Position', blank=True) + nominees = models.ManyToManyField('nomcom.Nominee', blank=True) + topics = models.ManyToManyField('nomcom.Topic', blank=True) subject = models.TextField(verbose_name='Subject', blank=True) comments = models.BinaryField(verbose_name='Comments') type = ForeignKey(FeedbackTypeName, blank=True, null=True) diff --git a/requirements.txt b/requirements.txt index e627d07676..d860a5308e 100644 --- a/requirements.txt +++ b/requirements.txt @@ -22,8 +22,7 @@ django-markup>=1.5 # Limited use - need to reconcile against direct use of ma django-oidc-provider>=0.8.1 # 0.8 dropped Django 2 support django-referrer-policy>=1.0 django-simple-history>=3.0.0 -#django-stubs>=4.2.0 # The django-stubs version used determines the the mypy version indicated below -django-stubs==4.2.4 # Pin here until we fix test failures (and update mypy version, too) +django-stubs>=4.2.7 # The django-stubs version used determines the the mypy version indicated below django-tastypie>=0.14.5 # Version must be locked in sync with version of Django django-vite>=2.0.2,<3 django-webtest>=1.9.10 # Only used in tests @@ -46,7 +45,7 @@ markdown>=3.3.6 types-markdown>=3.3.6 mock>=4.0.3 # Used only by tests, of course types-mock>=4.0.3 -mypy~=1.2.0 # Version requirements determined by django-stubs. +mypy~=1.7.0 # Version requirements determined by django-stubs. oic>=1.3 # Used only by tests Pillow>=9.1.0 psycopg2>=2.9.6