You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Declare manager class attributes on models as ClassVars (#1672)
* Move ModelBase.objects declaration to Model.objects, for mypy 1.5.0
mypy 1.5.0 was fixed to understand that metaclass attributes take
precedence over attributes in the regular class. So we need to
declare `objects` in the regular class to allow it to be overridden in
subclasses.
Fixes#1648.
Signed-off-by: Anders Kaseorg <[email protected]>
* Declare manager class attributes on models as `ClassVar`s
Inclusions:
- Adjustments for the plugin to make generated managers `ClassVar`s
- Changes the default 'objects' to 'ClassVar' and controls it via the
plugin
- Plugin ensures to only add the 'objects' manager to models it exists
on during runtime
* fixup! Declare manager class attributes on models as `ClassVar`s
* Enforce appropriate keyword only arguments
Co-authored-by: Nikita Sobolev <[email protected]>
* [pre-commit.ci] auto fixes from pre-commit.com hooks
* Bump mypy
* Remove a bunch of `-redefinition` lines from `allowlist_todo.txt`
---------
Signed-off-by: Anders Kaseorg <[email protected]>
Co-authored-by: Anders Kaseorg <[email protected]>
Co-authored-by: Nikita Sobolev <[email protected]>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
0 commit comments