Commit 5b93b30f authored by Arnaud Fontaine's avatar Arnaud Fontaine

pylint: Consider all imports as absolute.

This should have no impact on existing code as pylint is ran on a named
temporary file anyway but it avoids useless checks for relative imports
and thus is slightly faster.
parent 4f385666
Pipeline #9811 failed with stage
...@@ -179,7 +179,6 @@ def fail_hook_erp5_component(modname): ...@@ -179,7 +179,6 @@ def fail_hook_erp5_component(modname):
else: else:
module = _buildAstroidModuleFromComponentModuleName(modname) module = _buildAstroidModuleFromComponentModuleName(modname)
module._absolute_import_activated = True
return module return module
MANAGER.register_failed_import_hook(fail_hook_erp5_component) MANAGER.register_failed_import_hook(fail_hook_erp5_component)
...@@ -224,6 +223,10 @@ def _getattr(self, name, *args, **kw): ...@@ -224,6 +223,10 @@ def _getattr(self, name, *args, **kw):
return [ast] return [ast]
Module.getattr = _getattr Module.getattr = _getattr
# A temporary file is created to run pylint so this is not needed per se but
# it avoids useless checking for relative imports
Module.absolute_import_activated = lambda self: False
from astroid import register_module_extender from astroid import register_module_extender
def AccessControl_PermissionRole_transform(): def AccessControl_PermissionRole_transform():
return AstroidBuilder(MANAGER).string_build(''' return AstroidBuilder(MANAGER).string_build('''
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment