* Add type hints for the postgres CursorDebugWrapper, expand the BaseCursorDebugWrapper.
* Fix how Optinal gets applied.
* Fix optional handling further.
* Adjust postgres debugcursorwrapper to look more like the implementation.
* Apply review feedback.
* Use the more generic HttpResponseBase when appriopriate.
* Fix failing test and add new test.
* Remove the other test again, it was the wrong location. Add new tests in the correct location.
Co-authored-by: LanDinh <coding+sourcetree@khaleesi.ninja>
* Update decorators.pyi to match Django 3.1
This commit resembles the state of the file in Django 3.1. Unfortunately, this is not even compatible with Django 3.0 which misses the sync* and async* decorators.
* Update decorators.pyi
* Fixes lint
Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
* Ensure that all registered checks return a list of CheckMessage
This changes missing and Any return types on registered checks to always
return "List[CheckMessage]".
In many cases, check functions were already annotated to return in a more
specific type than CheckMessage (e.g. Error). In these cases, it's assumed
that the existing annotation is correct, and the more specific type is kept.
* Update model_checks.pyi
Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
* Replace models.Model annotations with type variables
* Adds generic type args to generic views
* Adds more tests
* Revert "Adds generic type args to generic views"
This reverts commit 6522f30cdb9027483f46d77167394c84eb7b7f4b.
* Adds Generic support for DetailView and ListView
Co-authored-by: sobolevn <mail@sobolevn.me>
This addresses an obscure crash we're getting when defining a GenericForeignKey
subclass on a model.
Not sure how this slipped through type checking since
`helpers.lookup_class_typeinfo -> Optional[TypeInfo]` while
`.get_private_descriptor_type(type_info: TypeInfo)` so this should be a clear
type violation.
* Add type hints for the postgres CursorDebugWrapper, expand the BaseCursorDebugWrapper.
* Fix how Optinal gets applied.
* Fix optional handling further.
* Adjust postgres debugcursorwrapper to look more like the implementation.
* Apply review feedback.
Co-authored-by: LanDinh <coding+sourcetree@khaleesi.ninja>
* Add URLPattern options to django.url.conf since they were missing.
* Fix some wording in the contribution guide & fix a reference to Django version 3.0, which has since been replaced by 3.1 as new stable version.
* My bad - I was misreading the type hints a bit here. Fix tests.
* We need to specify the List[Union[URLResolver, URLPattern]] upfront, since those don't accept List[URLResolver] as argument.
* Add test to ensure that path() accepts a mix of URLPatterns & URLResolvers.
Co-authored-by: LanDinh <coding+sourcetree@khaleesi.ninja>
Prior to this change, ManyToManyField was declared as being generic in
_ST and _GT, but also used the _T Typevar in its __init__ signature.
This caused mypy to add _T to the variables it was generic in when used
as an alias.
The symptom of this problem was that mypy would show an error with the
message "Type application has too few types (3 expected)" where a
ManyToManyField alias was declared, but adding an extra argument would
fail because the type only takes two arguments.
This change brings the signature of ManyToManyField in line with
ForeignKey and OneToOneField.
* Update static.pyi
Parameters document_root and show_indexes should be marked as Optional since they have a default value.
* Update static.pyi
Correct signature of serve function.