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>
This commit is contained in:
Petter Friberg
2022-01-24 11:24:09 +01:00
committed by GitHub
parent 220f0e4cf0
commit 515e382d4a
4 changed files with 69 additions and 25 deletions

View File

@@ -9,6 +9,9 @@ from mypy_django_plugin.lib.helpers import is_annotated_model_fullname
def typecheck_queryset_filter(ctx: MethodContext, django_context: DjangoContext) -> MypyType:
# Expected formal arguments for filter methods are `*args` and `**kwargs`. We'll only typecheck
# `**kwargs`, which means that `arg_names[1]` is what we're interested in.
lookup_kwargs = ctx.arg_names[1]
provided_lookup_types = ctx.arg_types[1]