From 92e5f202ace56be61b0ffb8c6291237db1554216 Mon Sep 17 00:00:00 2001 From: Petter Friberg Date: Thu, 31 Mar 2022 09:21:21 +0200 Subject: [PATCH] Cache dynamically created manager nodes (#840) - Non plugin generated, "cross_ref"s points to dynamically created managers (e.g. `Model.objects`) and can make Mypy fail on cached runs --- mypy_django_plugin/transformers/managers.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/mypy_django_plugin/transformers/managers.py b/mypy_django_plugin/transformers/managers.py index 09c2ea6c6..9fada102b 100644 --- a/mypy_django_plugin/transformers/managers.py +++ b/mypy_django_plugin/transformers/managers.py @@ -217,7 +217,6 @@ def create_new_manager_class_from_from_queryset_method(ctx: DynamicClassDefConte new_manager_info, name=name, sym_type=AnyType(TypeOfAny.special_form), - no_serialize=True, ) # we need to copy all methods in MRO before django.db.models.query.QuerySet @@ -278,9 +277,7 @@ def create_new_manager_class_from_from_queryset_method(ctx: DynamicClassDefConte ) # Insert the new manager (dynamic) class - assert semanal_api.add_symbol_table_node( - ctx.name, SymbolTableNode(GDEF, new_manager_info, plugin_generated=True, no_serialize=True) - ) + assert semanal_api.add_symbol_table_node(ctx.name, SymbolTableNode(GDEF, new_manager_info, plugin_generated=True)) def fail_if_manager_type_created_in_model_body(ctx: MethodContext) -> MypyType: