Nikita Sobolev
feb0bfa4a6
Updates deps ( #788 )
...
* Updates deps
* Updates deps
2021-12-16 22:39:12 +03:00
Nikita Sobolev
02a39f722d
Replace toml with tomli ( #787 )
...
* Replace `toml` with `tomli`
* Replace `toml` with `tomli`
2021-12-16 22:19:34 +03:00
Nikita Sobolev
b50a9077f8
Adds django@4.0 support ( #786 )
...
* Adds django@4.0 support
* Fixes CI
* Fixes CI
* Ignore new error for django4.0
* Fixes
2021-12-16 21:51:46 +03:00
sobolevn
e9b328a935
Updates deps, adds mypy@0.920 compat, adds dependabot
2021-12-16 13:11:06 +03:00
Nikita Sobolev
eb80b949af
Refs #774 ( #777 )
...
* Refs #774
* Update test_create.yml
2021-12-15 15:53:24 +03:00
Chris Beaven
1219d62b6a
Add Model._base_manager ( #776 )
2021-12-15 09:08:45 +03:00
Chris Beaven
daf6c659f0
Update autoreload to Django 3.2 ( #775 )
...
* Update autoreload stub to Django 3.2
* Fix some subclass return types
* types for watchmanreloader attributes
* Don't reference an redundant attribute in WatchmanReloader
2021-12-15 09:06:32 +03:00
w0rp
059471101c
Fix the get_field type for Pyright ( #773 )
...
This PR fixes the type of get_field so it won't report errors in
Pyright's strictest type checking mode.
2021-12-13 20:05:23 +03:00
Vadim Safonov
ccbbf86d0e
Update signature for Django 3.1 Paginator ( #770 )
2021-12-09 22:35:32 +03:00
Chris Beaven
69d4b1a86d
More accurate template.Parser parse_until type ( #769 )
2021-12-09 11:26:26 +03:00
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
Kevin Marsh
e5361f1e04
Fix QuerySet.create and Manager.create annotation since it doesn't accept *args (only **kwargs) ( #762 )
2021-11-30 18:37:54 +03:00
Stanislav Mikhailov
593d04d6e9
Fixed the types in ManyToManyField according to their definition in Django. ( #758 )
2021-11-24 01:13:45 +03:00
Sigurd Ljødal
a57ae4fc76
Fix BaseConnectionWrapper.execute_wrapper ( #752 )
...
This is a context manager, not an iterator.
Currently mypy will complain if it's used as documented.
2021-11-15 18:14:42 +03:00
David Cain
331042d1c7
Add signature for Django 3.2 TimestampSigner ( #751 )
...
Django 3.2 introduced two new methods: `sign_object` and
`unsign_object` which can sign/unsign "complex data structures" such as
lists, tuples, dictionaries:
https://docs.djangoproject.com/en/3.2/topics/signing/#django.core.signing.TimestampSigner
Because the methods take an arbitrary serializer (a JSON serializer by
default, but not guaranteed), we cannot be sure of the type of `obj`.
2021-11-13 22:56:27 +03:00
Avery Fischer (biggerfisch)
b5c20100ff
Update MigrationExecutor stubs to use Sequence ( #749 )
...
There is no need for a specific List type here, using a higher type
works fine and allows more working code to pass type-checking.
2021-11-12 20:10:24 +03:00
Petter Friberg
48aaf3d2ac
Implement stubs for views.decorators.common.no_append_slash ( #743 )
2021-11-01 18:04:58 +03:00
Chris Beaven
640553dcd7
Fix boundfield method parameters ( #741 )
2021-10-26 14:34:08 +03:00
Yukio Mizuta
95060b54c2
Update send_mail recipient_list type from List[str] to Sequence[str] ( #740 )
2021-10-22 21:51:57 +03:00
Simon Charette
09c3dc894b
Adjust django.core.signing.dumps and loads key type. ( #739 )
...
An optional key can be provided to these functions.
2021-10-22 21:02:01 +03:00
星
9482f2f81c
fix django.contrib.auth.models.Group.natural_key no return type ( #724 )
2021-10-19 15:03:53 +03:00
Brian Helba
676750e090
Add a definition for Storage.get_alternative_name ( #732 )
...
See: https://github.com/django/django/blob/f5802a21c401b92764a9f3e2886144f3c5d77573/django/core/files/storage.py#L65
2021-10-19 14:53:22 +03:00
Brian Helba
7c87c720ad
Correct the type of FileField.storage ( #731 )
...
* Correct the type of FileField.storage
This instance property can't be a callable. Although the FileField constructor
allows a callable, it is immediately resolved to an instance of Storage.
See: https://github.com/django/django/blob/f5802a21c401b92764a9f3e2886144f3c5d77573/django/db/models/fields/files.py#L231-L235
* Correct the type of FieldFile.storage
This instance property is copied directly from `FileField.storage` and should be
the same type.
See: https://github.com/django/django/blob/f5802a21c401b92764a9f3e2886144f3c5d77573/django/db/models/fields/files.py#L21
2021-10-19 14:40:17 +03:00
Rob Percival
9938378e94
Make AddRelatedManagers look for "objects" on parent model ( #730 )
...
* Add failing test for relation to model inheriting `objects`
Fails with:
```
pytest_mypy_plugins.utils.TypecheckAssertionError: Invalid output:
Expected:
main:2: note: Revealed type is "myapp.models.MyUser*"
main:3: note: Revealed type is "myapp.models.MyUser*"
<45 (diff)
<45 (diff)
Actual:
main:2: note: Revealed type is "myapp.models.MyUser*"
main:3: note: Revealed type is "myapp.models.MyUser*"
main:6: error: "MyUser" has no attribute "book_set" (diff)
main:6: note: Revealed type is "Any" (diff)
main:7: error: "MyUser" has no attribute "article_set" (diff)
main:7: note: Revealed type is "Any" (diff)
```
* Make AddRelatedManagers look for "objects" on parent model
Previously, AddRelatedManagers would fail if a related model had inherited
its `objects` field from a parent class. This would result in missing
relation attributes. This is fixed by using `get()` instead of `names`;
the former searches the MRO for the symbol, whereas the latter only looks
for symbols declared directly on the class.
2021-10-19 14:31:14 +03:00
Nikita Sobolev
7ac33f3a28
Fixes CI ( #734 )
...
* Fixes CI
* Fixes CI
* Fixes CI
2021-10-19 14:10:25 +03:00
Terence Honles
fb12560981
update all path related operations to have more accurate types ( #713 )
2021-09-11 22:41:16 +03:00
Terence Honles
799b41fe47
fix typing on HttpResponse and StreamingHttpResponse ( #712 )
...
While the documentation for `HttpResponse` and `StreamingHttpResponse`
*says* `content` and `streaming_content` should be bytestrings [1] or an
iterable of bytestrings respectively [2], this is not what the API
supports [3] [4] and there are tests which make sure the API supports
more than bytestrings [5] [6] [etc]. Before assigning `content` or
`streaming_content` the code paths will call `self.make_bytes` to
coerce the value to bytes.
[1]: https://github.com/django/django/blob/ecf87ad513fd8af6e4a6093ed918723a7d88d5ca/django/http/response.py#L324-L327
[2]: https://github.com/django/django/blob/0a28b42b1510b8093a90718bafd7627ed67fa13b/django/http/response.py#L395-L399
[3]: https://github.com/django/django/blob/ecf87ad513fd8af6e4a6093ed918723a7d88d5ca/django/http/response.py#L342-L362
[4]: https://github.com/django/django/blob/0a28b42b1510b8093a90718bafd7627ed67fa13b/django/http/response.py#L415-L427
[5]: https://github.com/django/django/blob/0a28b42b1510b8093a90718bafd7627ed67fa13b/tests/cache/tests.py#L2250
[6]: https://github.com/django/django/blob/0a28b42b1510b8093a90718bafd7627ed67fa13b/tests/i18n/urls.py#L8
2021-09-10 23:18:20 +03:00
Terence Honles
fb4d20475b
add HashedFilesMixin.url argument force ( #714 )
2021-09-10 10:02:48 +03:00
Craig
a1f3712c43
Add SmallAutoField ( #710 )
...
* Add SmallAutoField
* Test SmallAutoField presents as int
2021-09-09 15:58:03 +03:00
sobolevn
372b1340a0
Version django-stubs-ext@0.3.1 release
2021-09-07 22:08:49 +03:00
Eero Ruohola
6424e33a74
Fix BaseModelForm not working with generic type parameter ( #705 )
...
Resolves: https://github.com/typeddjango/django-stubs/issues/703
2021-09-07 22:07:22 +03:00
Eero Ruohola
b6d3373c34
Add typing-extension as a direct dependency of django-stubs-ext ( #707 )
...
Needed, because `django-stubs-ext` generally has to specified as a
production dependency (to use the monkey patching). `django-stubs` does
have `typing-extensions` as a dependency, but it is often used only as a
dev dependency as it has not runtime functionality.
Resolves: https://github.com/typeddjango/django-stubs/issues/702
2021-09-07 12:01:21 +03:00
Nikita Sobolev
f98330356c
Update bug.md
2021-09-04 20:10:23 +03:00
sobolevn
a33d8a9e59
Version 1.9.0 release
2021-09-04 11:54:02 +03:00
sobolevn
d6ccecdd73
Version 1.9.0 release
2021-09-04 11:33:39 +03:00
sobolevn
321284ac62
Version 1.9.0 release
2021-09-04 11:31:11 +03:00
sobolevn
a0f893ea3d
Version django-stubs-ext@0.3.0 release
2021-09-04 11:30:30 +03:00
PIG208
0d8dd85442
Minor fixes to improve django-stubs ( #695 )
...
* Use `Sequence` instead of `Iterable` for `send_messages`.
According to the documentation
(https://docs.djangoproject.com/en/3.2/topics/email/#email-backends ),
`email_messages` is a list. Using `Iterable` will make it hard for
subclasses to implement this method utilizing functions like `__len__`.
While this still allows subclasses to accept `Iterable`.
* Fix function signature of `authenticate` of `BaseBackend`.
1. BaseBackend no longer requires the username and password argument.
They were removed 3 years ago in the commit below when `BaseBackend` is added:
https://github.com/django/django/commit/75337a60509fdfdd321a5caf8e30d57fff6b9518
2. `request` is optional for `authenticate` method.
According to django documentation, the authenticate method does not
necessarily require the request object.
https://docs.djangoproject.com/en/3.2/topics/auth/default/#authenticating-users
* Tighten the type of `streaming_content` to `Iterator[bytes]`.
It is an iterator of a bytestring according to the documentation:
https://docs.djangoproject.com/en/3.2/ref/request-response/#django.http.StreamingHttpResponse.streaming_content
* Fix function signature of `django.contrib.staticfiles.serve`.
Since this `serve` function uses `django.views.static.serve` that
accepts `HttpRequest` as its first argument, it is more reasonable
to type it with `HttpRequest` instead of `WSGIRequest`.
Related:
https://github.com/django/django/blob/main/django/contrib/staticfiles/views.py#L39
2021-08-16 10:59:04 +03:00
PIG208
a6a81797d3
Add py.typed to package distribution of django_stubs_ext. ( #694 )
2021-08-15 17:52:44 +03:00
PIG208
8674c48c59
Fixes a broken link in CONTRIBUTING.md ( #690 )
2021-08-12 19:50:29 +03:00
Tim Nyborg
44f7c25a4e
extend ProtectedError and RestrictedError stubs ( #682 )
...
types for their properties
2021-08-03 11:13:15 +03:00
Abhyudai
696f39b58c
Remove assertions for mypy builtins ( #685 )
2021-08-01 11:14:13 +03:00
Abhyudai
01eecf901f
Add tests for some queryset methods ( #684 )
2021-08-01 11:12:06 +03:00
Abhyudai
695a7d71a7
Update type of BinaryField to include memoryview as well ( #686 )
2021-08-01 11:10:15 +03:00
Seth Yastrov
8da8ab4862
Fix/673/from queryset then custom qs method ( #680 )
...
* Fix `MyModel.objects.filter(...).my_method()`
* Fix regression: `MyModel.objects.filter(...).my_method()` no longer worked when using from_queryset
This also fixes the self-type of the copied-over methods of the manager generated by from_queryset.
Previously it was not parameterized by the model class, but used Any.
The handling of unbound types is not tested here as I have not been able to
find a way to create a test case for it. It has been manually tested
against an internal codebase.
* Remove unneeded defer.
2021-07-30 01:01:39 +03:00
Richard Xia
08a662ecb1
Change PasswordResetForm.get_users() to return Iterable, not Iterator. ( #678 )
...
This matches the actual implementation in Django, where it only attempts
to use the result of get_users() in a for loop, which allows for any
Iterable, and it provides a more flexible and idiomatic API for users
who subclass PasswordResetForm.
2021-07-29 12:35:28 +03:00
Richard Xia
0d7c32f38e
Change PasswordResetForm.save() to accept HttpRequest, not WSGIRequest. ( #679 )
2021-07-29 12:26:06 +03:00
Michael Williamson
51183231e0
Add @display to django.contrib.admin ( #677 )
...
The `display` decorator is defined in `django.contrib.admin.decorators`, but
isn't included in `django.contrib.admin`, which is how the Django docs describe
its usage.
2021-07-27 16:31:41 +03:00
snmishra
d29dacd64b
Add accepts method stub in HttpRequest ( #676 )
...
* Add accepts method to HttpRequest stubs
The accepts method (and dependencies) was missing in the stub for HttpRequest
* Change accepted_types to return correct type
* Fix Black formatting
* Add annotation for MediaType __init__ args
2021-07-25 18:53:37 +03:00