* 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.
This incorporates all type information I could glean from loaddata at
django/django@adb40d217e.
- Remove `help` per review comment:
https://github.com/typeddjango/django-stubs/pull/536#discussion_r533179013
- Add `exclude_models` and `exclude_apps` based on the return type of
`..utils.parse_apps_and_model_labels`.
- Change `loaddata`'s `fixture_labels` to `Sequence` of `str` instead of
`Iterable` because in practice it's a tuple, but at a type level, the
important thing is that `loaddata` iterates over `fixture_labels` more than
once. General iterables (which include iterators) need not support iteration
more than once.
- Correct the return type of `parse_name` to account for the possibility that
the data and compression formats are `None`.
- Correct the return type of `find_fixtures` to be a list of the same type that
`parse_name` returns.
- Add a type annotation for `SingleZipReader.read`. Django implements the method
in a way that actually conflicts with `zipfile.ZipFile.read`'s type. This
necessitates a `type: ignore[override]` to keep the tests passing. Mypy is
correct that there is an override error, but Django's code is what it is.
(And that method's signature was introduced way back in Django version 1.1,
commit django/django@089ab18c025917f38a2e3731ae4024d4810df1ec.)
- Added some of the instance attributes from command arguments: ignore, using, app_label, verbosity, format.
- Added class attribute: help.
- Fixed return type of find_fixtures.