mirror of
https://github.com/davidhalter/django-stubs.git
synced 2025-12-08 04:54:48 +08:00
remove 'need type annotation for setting' error message
This commit is contained in:
@@ -50,15 +50,16 @@ def add_settings_to_django_conf_object(ctx: ClassDefContext,
|
|||||||
if copied is None:
|
if copied is None:
|
||||||
continue
|
continue
|
||||||
ctx.cls.info.names[name] = copied
|
ctx.cls.info.names[name] = copied
|
||||||
else:
|
# else:
|
||||||
context = Context()
|
# TODO: figure out suggestion to add type annotation
|
||||||
module, node_name = sym.node.fullname().rsplit('.', 1)
|
# context = Context()
|
||||||
module_file = api.modules.get(module)
|
# module, node_name = sym.node.fullname().rsplit('.', 1)
|
||||||
if module_file is None:
|
# module_file = api.modules.get(module)
|
||||||
return None
|
# if module_file is None:
|
||||||
context.set_line(sym.node)
|
# return None
|
||||||
api.msg.report(f"Need type annotation for '{sym.node.name()}'", context,
|
# context.set_line(sym.node)
|
||||||
severity='error', file=module_file.path)
|
# 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
|
ctx.cls.info.fallback_to_any = True
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -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.LIST) # E: Revealed type is 'Any'
|
||||||
reveal_type(settings.BASE_LIST) # E: Revealed type is 'Any'
|
reveal_type(settings.BASE_LIST) # E: Revealed type is 'Any'
|
||||||
[out]
|
[out]
|
||||||
mysettings:4: error: Need type annotation for 'LIST'
|
|
||||||
base:6: error: Need type annotation for 'BASE_LIST'
|
|
||||||
|
|
||||||
[env DJANGO_SETTINGS_MODULE=mysettings]
|
[env DJANGO_SETTINGS_MODULE=mysettings]
|
||||||
[file mysettings.py]
|
[file mysettings.py]
|
||||||
|
|||||||
Reference in New Issue
Block a user