From 94ddb8c8646d48b19ecd7149dbdf263cb68f22a3 Mon Sep 17 00:00:00 2001 From: Maxim Kurnikov Date: Thu, 6 Dec 2018 19:38:27 +0300 Subject: [PATCH] remove 'need type annotation for setting' error message --- mypy_django_plugin/plugins/settings.py | 19 ++++++++++--------- test-data/typecheck/settings.test | 2 -- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/mypy_django_plugin/plugins/settings.py b/mypy_django_plugin/plugins/settings.py index 0f63ea9..a9d48c3 100644 --- a/mypy_django_plugin/plugins/settings.py +++ b/mypy_django_plugin/plugins/settings.py @@ -50,15 +50,16 @@ def add_settings_to_django_conf_object(ctx: ClassDefContext, if copied is None: continue ctx.cls.info.names[name] = copied - else: - context = Context() - module, node_name = sym.node.fullname().rsplit('.', 1) - module_file = api.modules.get(module) - if module_file is None: - return None - context.set_line(sym.node) - api.msg.report(f"Need type annotation for '{sym.node.name()}'", context, - severity='error', file=module_file.path) + # else: + # TODO: figure out suggestion to add type annotation + # context = Context() + # module, node_name = sym.node.fullname().rsplit('.', 1) + # module_file = api.modules.get(module) + # if module_file is None: + # return None + # context.set_line(sym.node) + # api.msg.report(f"Need type annotation for '{sym.node.name()}'", context, + # severity='error', file=module_file.path) ctx.cls.info.fallback_to_any = True diff --git a/test-data/typecheck/settings.test b/test-data/typecheck/settings.test index 4d62ea8..8ec5612 100644 --- a/test-data/typecheck/settings.test +++ b/test-data/typecheck/settings.test @@ -40,8 +40,6 @@ reveal_type(settings.REGISTRY) # E: Revealed type is 'Union[main.Class, None]' reveal_type(settings.LIST) # E: Revealed type is 'Any' reveal_type(settings.BASE_LIST) # E: Revealed type is 'Any' [out] -mysettings:4: error: Need type annotation for 'LIST' -base:6: error: Need type annotation for 'BASE_LIST' [env DJANGO_SETTINGS_MODULE=mysettings] [file mysettings.py]