Commit ae5ee205 authored by Julien Muchembled's avatar Julien Muchembled

Do not fail completely if our pylint patch does not work with newer versions

parent d3cdfa4b
No related merge requests found
...@@ -22,9 +22,10 @@ from __future__ import absolute_import ...@@ -22,9 +22,10 @@ from __future__ import absolute_import
from inspect import getargspec from inspect import getargspec
try: try:
from pylint.checkers import imports from pylint.checkers.imports import ImportsChecker
import astroid import astroid
except ImportError: ImportsChecker.get_imported_module
except (AttributeError, ImportError):
pass pass
else: else:
def _get_imported_module(self, importnode, modname): def _get_imported_module(self, importnode, modname):
...@@ -64,11 +65,11 @@ else: ...@@ -64,11 +65,11 @@ else:
args = repr(modname) args = repr(modname)
self.add_message("F0401", args=args, node=importnode) self.add_message("F0401", args=args, node=importnode)
if 'modnode' in getargspec(imports.ImportsChecker.get_imported_module).args: if 'modnode' in getargspec(ImportsChecker.get_imported_module).args:
# BBB for pylint < 1.4.0 # BBB for pylint < 1.4.0
def get_imported_module(self, modnode, importnode, modname): def get_imported_module(self, modnode, importnode, modname):
return _get_imported_module(self, importnode, modname) return _get_imported_module(self, importnode, modname)
else: else:
get_imported_module = _get_imported_module get_imported_module = _get_imported_module
imports.ImportsChecker.get_imported_module = get_imported_module ImportsChecker.get_imported_module = get_imported_module
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