Commit Graph
14 Commits
Author SHA1 Message Date
Marti Raudsepp 6436a10d5a Add more precise RunSQL, RunPython migration hints (#768) 2021-12-08 15:11:35 +03:00
Marti Raudsepp 79d34d6f46 Add ValidationError type hints (#767) 2021-12-08 15:09:20 +03:00
Marti Raudsepp 45f6dc0362 Improve hints for database connections (DatabaseWrapper) (#612)
* `django.db.{connection, connections, router}` are now hinted -- including `ConnectionHandler` and `ConnectionRouter` classes.
* Several improvements to `BaseDatabaseWrapper` attribute hints.
* In many places, database connections were hinted as `Any`, which I changed to `BaseDatabaseWrapper`.
* In a few places I added additional `SQLCompiler` hints.
* Minor tweaks to nearby code.
2021-05-13 20:22:35 +03:00
Marti Raudsepp d1dd95181a Add a few missing Storage-related hints (#611) 2021-05-13 13:44:19 +03:00
Marti Raudsepp e8d03a0e22 Use BaseDatabaseWrapper class instead of sqlite3's wrapper (#610)
Code dealing with DatabaseWrapper instances should be capable of dealing
with any database, not just sqlite3.
2021-05-13 13:38:08 +03:00
Marti Raudsepp 36d1778e2a Django admin additions (#543) 2020-12-17 13:23:51 +03:00
Marti Raudsepp 5ff99fd047 Check arguments to django.urls.{path,re_path} functions (#464)
These functions were added in Django 2.0, but the stubs have been
incomplete since commit 9a68263257

The implementation is almost identical to `url()` from
`conf/urls/__init__.pyi`
2020-09-17 18:08:26 +03:00
Marti Raudsepp f77ebcd22c Add db.models.constants stub module (#462) 2020-09-17 18:07:03 +03:00
Marti Raudsepp 7af89ee6a6 Update to mypy 0.770 (#341) 2020-03-13 16:45:45 +03:00
Marti Raudsepp afa16bfb74 Make decorator functions transparent to Mypy (#306)
By declaring return type as -> Callable[[_C], _C], Mypy can infer that
the decorated function has also the same arguments and return type as
the original.

View functions are constrained to return HttpResponseBase (or any
subclass of it).

Also added typecheck test coverage to most of the cases.
2020-03-12 00:32:30 +03:00
Marti Raudsepp f77073157b Fix CI build errors (#339)
* Updated gitpython dependency to fix error:
  ModuleNotFoundError: No module named 'gitdb.utils.compat'
* Updated Django repository git refs because old 3.0.x commit hash gave error:
  stderr: 'fatal: reference is not a tree: 6cb30414bc0f83b49afc4cae76d4af5656effe9a'
* Newer Django version also needs new ignores.
2020-03-12 00:19:51 +03:00
Marti Raudsepp 95e6c94319 Improve test client type stubs (#322)
* Added missing `follow: bool` argument to Client request methods.
* Annotated return types as `HttpResponse` instead of `Any`.
* Made `Client` class inherit from `RequestFactory`, as it does in Django.
* Changed `json()` return type to Any, as it can also be a list.

Wrt (2), these return types were reverted from `HttpResponse` to `Any`
in commit 287c64d6fb. But I suspect that
was simply to silence mypy warnings about "incompatible with supertype
RequestFactory", not because there were any issues with the annotation.

Note that `Client.request()` monkey-patches the `HttpResponse` object
with some additional attributes. Those attributes were already annotated
before, I reordered and added additional comments to make it clear where
they come from.
2020-02-12 18:44:17 +03:00
Marti Raudsepp 6f296b0a91 Implement @cached_property attribute inference (#292) 2020-01-10 13:57:09 +03:00
Marti Raudsepp fb1593630a Expand stubs for django.core.management.color (#276)
Many attributes were previously missing; 'DEBUG' and 'INFO' attributes
were never supported by Django.
2019-12-16 20:16:21 +03:00