Commit Graph

119 Commits

Author SHA1 Message Date
Maxim Kurnikov
717be5940f Reorganize code a bit, add current directory to sys.path (#198)
* reorganize code a bit

* add current directory to sys.path

* remove PYTHONPATH mention from the docs

* linting
2019-10-05 19:44:29 +03:00
Maxim Kurnikov
02bdf5be95 add support for typechecking of filter/get/exclude arguments (#183)
* add support for typechecking of filter/get/exclude arguments

* linting
2019-09-30 03:05:40 +03:00
Maxim Kurnikov
2c23d8e70f Use runtime information to determine whether class is a models.Model subclass (#182) 2019-09-28 04:05:54 +03:00
Daniel Hahler
afcd0d9293 Bump isort, use --diff (#164)
* dev-requirements: bump isort: 4.3.4 => 4.3.21

* isort: use --diff

* known_first_party = mypy_django_plugin

* Run isort
2019-09-23 20:45:43 +03:00
Maxim Kurnikov
29ac1c3017 Split AddManagers for model in separate stages to process IncompleteDefnException properly (#171) 2019-09-18 02:20:20 +03:00
Maxim Kurnikov
23ad65033b add custom Field processing for mixins used in the Model subclasses (#167) 2019-09-18 01:40:41 +03:00
Maxim Kurnikov
2b53fa5a1a Fix typecheck tests ci (#165)
* remove mention of mypy newsemanal to prepare for 0.730

* make typecheck_tests CI really work

* fix lints

* fix intentional error

* merge stderr in stdout to preserve order

Co-authored-by: Daniel Hahler <github@thequod.de>
2019-09-16 14:35:13 +03:00
Maxim Kurnikov
fc9a335dfd make ValuesQuerySet have proper Collection generic type (#140) 2019-08-24 18:24:21 +03:00
Maxim Kurnikov
e95b40ef52 stability fixes 2019-08-24 17:04:50 +03:00
Maxim Kurnikov
d7e8222163 Fix related fields inheritance from abstract models (#138) 2019-08-24 02:35:55 +03:00
Maxim Kurnikov
656105bab2 make first() an Optional, allow to specify QuerySet with one parameter (#136) 2019-08-23 03:31:07 +03:00
Maxim Kurnikov
27793ecd32 allow to subclass queryset without loss of typing 2019-07-26 22:40:37 +03:00
Maxim Kurnikov
6b21a0476d Remove psycopg2 from dependencies (#117)
* remove psycopg2 from direct dependencies, only add it in tests

* bump to 1.0.1

* fix mypy
2019-07-26 18:39:42 +03:00
Maxim Kurnikov
735b58e9bf values_list for related model id flat True (#113) 2019-07-25 21:33:45 +03:00
Maxim Kurnikov
62dac1d468 remove some asserts that could be validly triggered 2019-07-25 19:53:12 +03:00
Maxim Kurnikov
409c01eb24 allow to specify QuerySet with one parameter 2019-07-25 19:22:59 +03:00
Maxim Kurnikov
4c21855641 fix mypy errors 2019-07-25 18:52:51 +03:00
Maxim Kurnikov
ae8e42dd53 lint 2019-07-24 22:56:14 +03:00
Maxim Kurnikov
b6a5ccabdf move configuration to [mypy.plugins.django-stubs] inside mypy config file 2019-07-24 22:32:52 +03:00
Maxim Kurnikov
df021f6baa add some support for proxy models 2019-07-24 13:39:23 +03:00
Maxim Kurnikov
57796077c6 create(id=None) is valid, if id is AutoField 2019-07-24 13:38:50 +03:00
Maxim Kurnikov
4dfa363521 lint fixes 2019-07-24 13:38:50 +03:00
Maxim Kurnikov
2c001fd8a7 cleanups 2019-07-24 13:38:49 +03:00
Maxim Kurnikov
a0db24c764 add objects to model, trade false positive for false negative 2019-07-24 13:38:49 +03:00
Maxim Kurnikov
39fb48b08a fix httprequest other fields 2019-07-24 13:38:49 +03:00
Maxim Kurnikov
d7d379e1cd create dummy classes for custom_manager_of_model usecase 2019-07-24 13:38:49 +03:00
Maxim Kurnikov
df77299c2f cleanups 2019-07-24 13:38:49 +03:00
Maxim Kurnikov
b86d33c718 allow custom app label for ForeignKey 2019-07-24 13:38:49 +03:00
Maxim Kurnikov
fa57fb0cbf request.user has type of AUTH_USER_MODEL 2019-07-24 13:38:49 +03:00
Maxim Kurnikov
248504c25a various fixes 2019-07-24 13:38:49 +03:00
Maxim Kurnikov
fee4aad3d0 fix OneToOneField without related_name 2019-07-24 13:38:49 +03:00
Maxim Kurnikov
fc9843bea6 add support for _meta.get_field() typechecking 2019-07-24 13:38:49 +03:00
Maxim Kurnikov
5bb1bc250d add get_next_by_FOO, get_previous_by_FOO for date,datetime fields 2019-07-24 13:38:49 +03:00
Maxim Kurnikov
1721c997be add support for get_FIELD_display for choices fields 2019-07-24 13:38:49 +03:00
Maxim Kurnikov
07a9bcd4cb remove dataclasses dependency 2019-07-24 13:38:49 +03:00
Maxim Kurnikov
6ece759ca0 remove runtime dependency on pytest-mypy-plugins 2019-07-24 13:38:49 +03:00
Maxim Kurnikov
f2e79d3bfb add GenericForeignKey support, remove some false-positives 2019-07-24 13:38:49 +03:00
Maxim Kurnikov
bfa77efef5 one more edge case for values() 2019-07-24 13:38:49 +03:00
Maxim Kurnikov
4f935edd47 add reverse lookups to values(), values_list() 2019-07-24 13:38:49 +03:00
Maxim Kurnikov
03b59b872d cleanups, fallback to Any in some corner cases 2019-07-24 13:38:49 +03:00
Maxim Kurnikov
0e72b2e6fc more values(), values_list() cases 2019-07-24 13:38:49 +03:00
Maxim Kurnikov
b81fbdeaa9 remove -semanal suffix 2019-07-24 13:38:49 +03:00
Maxim Kurnikov
dc6101b569 remove old semanal plugin data 2019-07-24 13:38:49 +03:00
Maxim Kurnikov
b11a9a85f9 new semanal wip 1 2019-07-24 13:38:49 +03:00
Maxim Kurnikov
9c5a6be9a7 split helpers into smaller files 2019-07-24 13:38:49 +03:00
Maxim Kurnikov
5dd6eccdb5 make ignore_missing_model_attributes behaviour optional (#66)
make "ignore_missing_model_attributes" behaviour opt-in
2019-04-12 17:22:18 +03:00
Maxim Kurnikov
fd06816cbb Work around "no settings module" crash (#65)
Workaround "no settings module" crash
2019-04-12 17:14:23 +03:00
Maxim Kurnikov
aeb435c8b3 Disable monkeypatches, add dependencies via new hook (#60)
* code cleanups, disable monkeypatches, move to add_additional_deps

* disable incremental mode for tests

* add pip-wheel-metadata

* move some code from get_base_hook to get_attribute_hook to reduce dependencies

* simplify values/values_list tests and code

* disable cache for some tests failing with incremental mode

* enable incremental mode for tests typechecking

* pin mypy version

* fix tests

* lint

* fix internal crashes
2019-04-12 14:54:00 +03:00
Maxim Kurnikov
28a3f126ee make mypy.checker import locally to prevent import cycles 2019-04-01 19:39:50 +03:00
Seth Yastrov
71fb0432f3 52/model subtypes dont typecheck (#55)
* Fix problem where Model instancess are not considered subtypes of each other due to fallback_to_any = True. Fixes #52.

- Added a stub for __getstate__ to Model.
- Added a stub for clean() to Model.
- Correct arg type for sort_dependencies so they are covariant (Iterable rather than List).

Test ignores:
- Added some test ignores in cases where a model inherits from 2 different base models.
- Added some test ignores for cases that MyPy flags as errors due to variable redefinitions or imports that are incompatible types.

* Address review comment.
2019-03-28 23:13:02 +03:00