Commit Graph

888 Commits

Author SHA1 Message Date
w0rp
1672b54c89 Set type parameters for Field in get_fields() (#882)
* Set type parameters for Field in get_fields()

This fixes an issue with Pyright strict type checking where Pyright complains that the type parameters aren't known.

* Fix type parameters in other methods
2022-03-25 00:14:16 +03:00
Sebastian Wagner
32a33c332d Don't serialize annotated types (#881)
Signed-off-by: Sebastian Wagner <sebastian@inter.link>

Co-authored-by: Sebastian Wagner <sebastian@inter.link>
2022-03-22 14:33:52 +03:00
Anderson Luiz de Souza
10e06947d7 Fix missing args on SlugField.__init__ (#879) 2022-03-20 19:40:55 +03:00
dependabot[bot]
f4d3895595 Bump pytest from 7.1.0 to 7.1.1 (#880)
Bumps [pytest](https://github.com/pytest-dev/pytest) from 7.1.0 to 7.1.1.
- [Release notes](https://github.com/pytest-dev/pytest/releases)
- [Changelog](https://github.com/pytest-dev/pytest/blob/main/CHANGELOG.rst)
- [Commits](https://github.com/pytest-dev/pytest/compare/7.1.0...7.1.1)

---
updated-dependencies:
- dependency-name: pytest
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-03-19 20:37:03 +03:00
Himanshu Balasamanta
5c75869dd3 Fixes #822 (#868)
Signed-off-by: Himanshu-Balasamanta <himanshubb.eee18@itbhu.ac.in>
2022-03-15 12:46:49 +03:00
dependabot[bot]
acfafaae14 Bump pytest from 7.0.1 to 7.1.0 (#869)
Bumps [pytest](https://github.com/pytest-dev/pytest) from 7.0.1 to 7.1.0.
- [Release notes](https://github.com/pytest-dev/pytest/releases)
- [Changelog](https://github.com/pytest-dev/pytest/blob/main/CHANGELOG.rst)
- [Commits](https://github.com/pytest-dev/pytest/compare/7.0.1...7.1.0)

---
updated-dependencies:
- dependency-name: pytest
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-03-14 21:27:12 +03:00
Himanshu Balasamanta
f9f6c827c1 Fixes #870 (#871)
* Fixes #870

Signed-off-by: Himanshu-Balasamanta <himanshubb.eee18@itbhu.ac.in>

* Updated mypy version in setup.py to == 0.931

* Update setup.py

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2022-03-14 21:17:53 +03:00
Adam Johnson
eb6991b008 Improve forms stubs (#862)
* `default_renderer` may be a renderer class, instance, or `None`: https://docs.djangoproject.com/en/4.0/ref/forms/api/#django.forms.Form.default_renderer
* `field_order` should be a list/sequence of field names, or `None`: https://docs.djangoproject.com/en/4.0/ref/forms/api/#django.forms.Form.field_order
* `cleaned_data` should be a dict/mapping of field names to values, as returned by `clean()`: https://docs.djangoproject.com/en/4.0/ref/forms/api/#django.forms.Form.cleaned_data . I similarly updated `clean()` to allow arbitrary mappings, since it may be legitimate to use some special mapping class.
* `clean()` does not need to return a mapping - https://docs.djangoproject.com/en/4.0/ref/forms/validation/#validating-fields-with-clean : “If your form inherits another that doesn’t return a `cleaned_data` dictionary in its `clean()` method (doing so is optional)...”
* `is_multipart` returns a `bool`: https://docs.djangoproject.com/en/4.0/ref/forms/api/#django.forms.Form.is_multipart
* `hidden_fields` and `visible_fields` aren't documented, but they return lists of `BoundField` instances: d8b437b1fb/django/forms/forms.py (L501-L513)
2022-03-02 18:02:54 +03:00
dependabot[bot]
078925a0fc Bump actions/checkout from 2 to 3 (#861)
Bumps [actions/checkout](https://github.com/actions/checkout) from 2 to 3.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v2...v3)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-03-02 11:05:16 +03:00
dependabot[bot]
cf31c1de7b Bump actions/setup-python from 2 to 3 (#860)
Bumps [actions/setup-python](https://github.com/actions/setup-python) from 2 to 3.
- [Release notes](https://github.com/actions/setup-python/releases)
- [Commits](https://github.com/actions/setup-python/compare/v2...v3)

---
updated-dependencies:
- dependency-name: actions/setup-python
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-03-01 09:42:54 +03:00
Ethan Corey
104012b817 Added widget_type annotation to BoundField (#855)
* Add widget_type annotation to BoundField

See https://github.com/django/django/blob/main/django/forms/boundfield.py#L283

* Tweaked annotation to be `AnyStr`, not `str`

* Reverted to use `str` as return type
2022-02-22 22:47:43 +03:00
rolandcrosby-check
850df1655a Make formfield_from_dbfield return forms.Field instead of models.Field (#857) 2022-02-22 20:44:44 +03:00
dependabot[bot]
30bed85e0d Bump gitpython from 3.1.20 to 3.1.27 (#854)
Bumps [gitpython](https://github.com/gitpython-developers/GitPython) from 3.1.20 to 3.1.27.
- [Release notes](https://github.com/gitpython-developers/GitPython/releases)
- [Changelog](https://github.com/gitpython-developers/GitPython/blob/main/CHANGES)
- [Commits](https://github.com/gitpython-developers/GitPython/compare/3.1.20...3.1.27)

---
updated-dependencies:
- dependency-name: gitpython
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-02-21 09:47:17 +03:00
Joon Hwan 김준환
ab50fb9876 cache_page should be Optional[float] . (#851)
* cache_page can use None .

* Apply black
2022-02-14 15:14:28 +03:00
Joon Hwan 김준환
319ab7f9f7 get_cache_key can have multiple httprequest types. (#852)
* Update cache.pyi

* Apply black
2022-02-14 15:06:01 +03:00
dependabot[bot]
017ac1ce85 Bump pytest from 7.0.0 to 7.0.1 (#850)
Bumps [pytest](https://github.com/pytest-dev/pytest) from 7.0.0 to 7.0.1.
- [Release notes](https://github.com/pytest-dev/pytest/releases)
- [Changelog](https://github.com/pytest-dev/pytest/blob/main/CHANGELOG.rst)
- [Commits](https://github.com/pytest-dev/pytest/compare/7.0.0...7.0.1)

---
updated-dependencies:
- dependency-name: pytest
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-02-14 10:50:43 +03:00
Jacob Walls
bf84546b9e Fix return type of MigrationRecorder.applied_migrations() (#793)
Matches return type of MigrationLoader.applied_migrations, which reads from here.
2022-02-10 18:29:14 +03:00
Kevin Marsh
3eab36a5c4 DatabaseClient: add missing class methods and reflect Django 3.2 refactor (#846)
* DatabaseClient: add missing class method `settings_to_cmd_args_env` and add missing arg to `runshell`

The `DatabaseClient.runshell()` was refactored in Django 3.2 to be more standardized
across the different database backends.

* DatabaseClient: make `settings_dict` dict type better by specifying key/value types

* tests: add missing db backend client files to `import_all_modules`
2022-02-10 09:29:44 +03:00
dependabot[bot]
01a31d2fd5 Bump pytest from 6.2.5 to 7.0.0 (#845)
Bumps [pytest](https://github.com/pytest-dev/pytest) from 6.2.5 to 7.0.0.
- [Release notes](https://github.com/pytest-dev/pytest/releases)
- [Changelog](https://github.com/pytest-dev/pytest/blob/main/CHANGELOG.rst)
- [Commits](https://github.com/pytest-dev/pytest/compare/6.2.5...7.0.0)

---
updated-dependencies:
- dependency-name: pytest
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-02-07 09:12:33 +03:00
Rob Percival
74083c9f8a Correct return type of get_commands() (#838)
According to the docstring for this function, "the instantiated module can be placed in the dictionary in place of the application name".
2022-01-31 20:28:32 +03:00
dependabot[bot]
8843acde3e Bump black from 21.12b0 to 22.1.0 (#836)
Bumps [black](https://github.com/psf/black) from 21.12b0 to 22.1.0.
- [Release notes](https://github.com/psf/black/releases)
- [Changelog](https://github.com/psf/black/blob/main/CHANGES.md)
- [Commits](https://github.com/psf/black/commits/22.1.0)

---
updated-dependencies:
- dependency-name: black
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-01-31 08:45:07 +03:00
Petter Friberg
8aae836a26 Model.__init__ supporting same typing as assigment (#835)
* `Model.__init__` supporting same typing as assigment

* Update mypy_django_plugin/django/context.py
2022-01-29 12:07:26 +03:00
Seth Yastrov
c556668d7a Attempt to fix 'INTERNAL ERROR using annotate'. (#753)
KeyError: "Failed qualified lookup: '_AnyAttrAllowed' (fullname =
'django._AnyAttrAllowed')."

https://github.com/typeddjango/django-stubs/issues/745
2022-01-28 21:43:03 +03:00
Cory Dolphin
28d6dc992c Export Datasource, Driver from gdal (#797) 2022-01-28 21:42:26 +03:00
emma-blossom
73290597f8 Make SomeModel._default_manager return a BaseManager[SomeModel] instead of BaseManager[Model] (#817)
* _default_manager has more specific type for TypeVars

* remove unnecessary # type: ignore

* add test for _base_manager

* add overloads for classproperty.__get__

* readd # type: ignore for WSGIRequestHandler.connection, fails in github's pipeline

* fix _base_manager test: mypy reveals an inferred type

Co-authored-by: Michael Pöhle <michael.poehle@polyteia.de>
2022-01-28 21:42:11 +03:00
Maarten ter Huurne
060dc3b41a Add object_list to BaseListView (#833)
While `object_list` isn't defined at construction, `BaseListView.get()`
sets it when handling a request, so in practice it is defined whenever
a list view is doing its work.

The Django documentation describes `object_list` as "the list of
objects (usually, but not necessarily a queryset)", so I picked
`Sequence` as the type.

Closes #790
2022-01-28 21:41:30 +03:00
rolandcrosby-check
5d3768e593 Allow *args to be Any for generic views (#831) 2022-01-26 10:00:26 +03:00
Petter Friberg
515e382d4a Fix .filter-kwargs lookup crash during cached runs (#828)
* Fix .filter-kwargs lookup crash during cached runs

* Update mypy_django_plugin/lib/helpers.py

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2022-01-24 13:24:09 +03:00
Petter Friberg
220f0e4cf0 Reuse reverse managers instead of recreating (#825) 2022-01-22 21:13:05 +03:00
Petter Friberg
edec5a1c99 Notify when Manager.from_queryset happens inside model class body (#824)
* Refactor to more easily support additional config options

* Notify when Manager.from_queryset happens inside model class body

- A warning will be emitted whenever `Manager.from_queryset` happens
  inside of a model class body

* Resolve generated default manager types before final iteration

A default manager on a model should always exist, eventually. Although,
we extend to look through dynamically generated managers on each
iteration instead of deferring until the final iteration.
2022-01-21 19:46:56 +03:00
dependabot[bot]
140bb38a79 Bump pre-commit from 2.16.0 to 2.17.0 (#823)
Bumps [pre-commit](https://github.com/pre-commit/pre-commit) from 2.16.0 to 2.17.0.
- [Release notes](https://github.com/pre-commit/pre-commit/releases)
- [Changelog](https://github.com/pre-commit/pre-commit/blob/master/CHANGELOG.md)
- [Commits](https://github.com/pre-commit/pre-commit/compare/v2.16.0...v2.17.0)

---
updated-dependencies:
- dependency-name: pre-commit
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-01-19 09:58:07 +03:00
Nikita Sobolev
c04201c859 Delete FUNDING.yml 2022-01-17 15:04:29 +03:00
sobolevn
5bbe353e92 Add FUNDING.yml and drop python3.6 2022-01-17 15:00:27 +03:00
Aleksander Vognild Burkow
27e5908762 Update project to use mypy 931 (#819) 2022-01-17 14:58:16 +03:00
Petter Friberg
a9e41a8ba9 Fix suggested changes from #820 (#821) 2022-01-16 21:13:47 +03:00
Petter Friberg
99f28387fb Set custom queryset methods as manager attrs instead of method copies (#820)
Instead of copying methods over from a QuerySet passed to a basemanager
when invoking '<BaseManager>.from_queryset', any QuerySet methods are
declared as attributes on the manager.

This allows us to properly lookup any QuerySet method types via a
'get_attribute_hook' and will thus remove disorienting phantom errors
occuring from mypy trying to resolve types only existing in the module
where the _original_ (and real) queryset method was declared.
2022-01-16 12:14:33 +03:00
rolandcrosby-check
1da693ebff Fix extra_context argument type in admin views (#816)
The `extra_context` argument to `ModelAdmin.changeform_view`,
`add_view`, `change_view`, `changelist_view`, `delete_view`, and
`history_view` is used to pass extra context variables to a template, so
all of these arguments should have type `Optional[Dict[str, Any]]`.
Instead, these are currently typed as `Optional[Dict[str, bool]]`,
`Optional[Dict[str, str]]`, or `None`.
2022-01-13 23:03:03 +03:00
rolandcrosby-check
3c1e9e3884 Allow Iterable[Iterable[Any]] as args_generator argument to format_html_join (#722)
* Allow List[Tuple[Any]] as args_generator argument to format_html_join

format_html_join's args_generator argument can be anything that contains
tuples of things that can be coerced to strings or that have a
`__html__` method.

Fixes #721.

* Use `Iterable[Iterable[Any]]` as `args_generator` type

* Run linter
2022-01-12 09:44:14 +03:00
dependabot[bot]
4cdf8a8d39 Bump pytest-mypy-plugins from 1.9.2 to 1.9.3 (#815)
Bumps [pytest-mypy-plugins](https://github.com/TypedDjango/pytest-mypy-plugins) from 1.9.2 to 1.9.3.
- [Release notes](https://github.com/TypedDjango/pytest-mypy-plugins/releases)
- [Changelog](https://github.com/typeddjango/pytest-mypy-plugins/blob/master/CHANGELOG.md)
- [Commits](https://github.com/TypedDjango/pytest-mypy-plugins/compare/1.9.2...1.9.3)

---
updated-dependencies:
- dependency-name: pytest-mypy-plugins
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-01-12 09:42:53 +03:00
rolandcrosby-check
7701957e4f Fix annotation of ModelAdmin.get_object (#812)
* Fix annotation of ModelAdmin.get_object

The type annotation in django-stubs indicated that the type of the
`from_field` argument to `ModelAdmin.get_object` should be `None`. In
fact, `None` is the default value of that argument. If the argument is
not `None`, [it is passed to a model's `_meta.get_field` method][impl], which
takes an argument of type `Union[Callable[..., Any], str`.

[impl]: ac5cc6cf01/django/contrib/admin/options.py (L767)

* Fix formatting
2022-01-08 10:48:29 +03:00
dependabot[bot]
fafb200e90 Bump requests from 2.27.0 to 2.27.1 (#807)
Bumps [requests](https://github.com/psf/requests) from 2.27.0 to 2.27.1.
- [Release notes](https://github.com/psf/requests/releases)
- [Changelog](https://github.com/psf/requests/blob/main/HISTORY.md)
- [Commits](https://github.com/psf/requests/compare/v2.27.0...v2.27.1)

---
updated-dependencies:
- dependency-name: requests
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-01-06 12:39:00 +03:00
Tom Carrick
118f50307c Allow expressions in UniqueConstraint (#806)
* Allow expressions in UniqueConstraint

* Use ellipsis

* And for fields
2022-01-06 12:07:24 +03:00
Abhyudai
3761c16c51 Change return type of queryset.bulk_update to int (#683)
- the change was made in the commit cd124295d8.
2022-01-05 18:42:47 +03:00
Gergely Kalmár
c65e2c48db Add typing to mypy plugin (#804) 2022-01-05 16:21:14 +03:00
Nikita Sobolev
ed68fbc99f Update typecheck_tests.py 2022-01-04 20:32:50 +03:00
Nikita Sobolev
9cad4fbfeb Delete misspel.yml 2022-01-04 20:32:18 +03:00
dependabot[bot]
3a27d8bb91 Bump requests from 2.26.0 to 2.27.0 (#803)
Bumps [requests](https://github.com/psf/requests) from 2.26.0 to 2.27.0.
- [Release notes](https://github.com/psf/requests/releases)
- [Changelog](https://github.com/psf/requests/blob/main/HISTORY.md)
- [Commits](https://github.com/psf/requests/compare/v2.26.0...v2.27.0)

---
updated-dependencies:
- dependency-name: requests
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-01-04 11:19:24 +03:00
Carl Johan Hambro
49bed6c28d Fix type for templatetag (#801) 2021-12-31 11:56:10 +03:00
Gabriel Augendre
3b02222beb Update syndication Feed class (#800)
* Update syndication Feed class

* Fix typing
2021-12-30 16:33:29 +03:00
Cory Dolphin
9483865284 Make geos.GEOSGeometryBase.equals_exact accept float (#796) 2021-12-29 11:16:16 +03:00