diff --git a/Pipfile b/Pipfile index 3df01ee..a7bc86f 100644 --- a/Pipfile +++ b/Pipfile @@ -18,6 +18,8 @@ pytest = "*" pytest-django = "*" requests-mock = "*" ruff = "*" +types-beautifulsoup4 = "*" +types-requests = "*" [packages] # Only needed for Heroku diff --git a/Pipfile.lock b/Pipfile.lock index 086b8ab..53f1db7 100644 --- a/Pipfile.lock +++ b/Pipfile.lock @@ -1,7 +1,7 @@ { "_meta": { "hash": { - "sha256": "97228badabb5f19b1ed2a543ecd4f48ccfb42403273ebac34e126c7223663df6" + "sha256": "13b351e976f806ce62d65eed3617904c512481404ed6764ad8b7c1976120ab2a" }, "pipfile-spec": 6, "requires": { @@ -1464,6 +1464,22 @@ "markers": "python_version >= '3.5'", "version": "==0.4.4" }, + "types-beautifulsoup4": { + "hashes": [ + "sha256:000cdddb8aee4effb45a04be95654de8629fb8594a4f2f1231cff81108977324", + "sha256:e37e4cfa11b03b01775732e56d2c010cb24ee107786277bae6bc0fa3e305b686" + ], + "index": "pypi", + "version": "==4.12.0.20240229" + }, + "types-html5lib": { + "hashes": [ + "sha256:22736b7299e605ec4ba539d48691e905fd0c61c3ea610acc59922232dc84cede", + "sha256:af5de0125cb0fe5667543b158db83849b22e25c0e36c9149836b095548bf1020" + ], + "markers": "python_version >= '3.8'", + "version": "==1.1.11.20240228" + }, "types-pytz": { "hashes": [ "sha256:9679eef0365db3af91ef7722c199dbb75ee5c1b67e3c4dd7bfbeb1b8a71c21a3", @@ -1479,6 +1495,14 @@ ], "version": "==6.0.12.12" }, + "types-requests": { + "hashes": [ + "sha256:a82807ec6ddce8f00fe0e949da6d6bc1fbf1715420218a9640d695f70a9e5a9b", + "sha256:f1721dba8385958f504a5386240b92de4734e047a08a40751c1654d1ac3349c5" + ], + "index": "pypi", + "version": "==2.31.0.20240218" + }, "typing-extensions": { "hashes": [ "sha256:69b1a937c3a517342112fb4c6df7e72fc39a38e7891a5730ed4985b5214b5475", diff --git a/pyproject.toml b/pyproject.toml index 318b8ee..d8bd325 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -2,18 +2,15 @@ line-length = 90 [tool.django-stubs] -django_settings_module = "solenoid.settings" +django_settings_module = "solenoid.settings.base" [tool.mypy] disallow_untyped_calls=true -disallow_untyped_defs=true +disallow_untyped_defs=false exclude=[ - "solenoid/wsgi.py", - "solenoid/accounts/migrations", - "solenoid/elements/migrations", - "solenoid/emails/migrations", - "solenoid/people/migrations/", - "solenoid/records/migrations/" + "^solenoid/.*/tests/.*", + "^solenoid/.*/migrations/.*", + "solenoid/wsgi.py" ] plugins = ["mypy_django_plugin.main"] @@ -21,3 +18,13 @@ plugins = ["mypy_django_plugin.main"] module = ["solenoid.elements.xml_handlers"] disable_error_code = ["union-attr"] +[[tool.mypy.overrides]] +module = [ + "celery_progress.backend", + "ckeditor.fields", + "ckeditor.widgets", + "debug_toolbar", + "environ" +] +ignore_missing_imports = true + diff --git a/solenoid/people/models.py b/solenoid/people/models.py index 9f8c544..494325d 100644 --- a/solenoid/people/models.py +++ b/solenoid/people/models.py @@ -19,18 +19,18 @@ # unending recursion, so we're following the suggestion in the documentation: # https://docs.djangoproject.com/en/1.8/topics/db/queries/#deleting-objects class ProtectiveQueryset(QuerySet): - def delete(self): + def delete(self): # type: ignore[no-untyped-def] for obj in self.all(): obj.delete() class DefaultManager(models.Manager): - def get_queryset(self): + def get_queryset(self) -> ProtectiveQueryset: return ProtectiveQueryset(self.model, using=self._db) class ActiveLiaisonManager(models.Manager): - def get_queryset(self): + def get_queryset(self) -> ProtectiveQueryset: return ProtectiveQueryset(self.model, using=self._db).filter(active=True) @@ -41,7 +41,7 @@ class Meta: verbose_name_plural = "Liaisons" ordering = ["last_name", "first_name"] - def __str__(self): + def __str__(self) -> str: return "{self.first_name} {self.last_name}".format(self=self) first_name = models.CharField(max_length=15) @@ -59,9 +59,9 @@ def __str__(self): # Liaisons. objects = ActiveLiaisonManager() - def save(self, *args, **kwargs): + def save(self, *args, **kwargs) -> None: if not self.active: - self.dlc_set.clear() + self.dlc_set.clear() # type: ignore[attr-defined] return super(Liaison, self).save(*args, **kwargs) diff --git a/solenoid/people/views.py b/solenoid/people/views.py index 8f145f8..b356519 100644 --- a/solenoid/people/views.py +++ b/solenoid/people/views.py @@ -112,7 +112,7 @@ def post(self, request, *args, **kwargs): return self.form_invalid(form) -class LiaisonDelete(ConditionalLoginRequiredMixin, DeleteView): +class LiaisonDelete(ConditionalLoginRequiredMixin, DeleteView): # type: ignore[misc] model = Liaison queryset = Liaison.objects.all()