diff options
author | Claudiu Popa <pcmanticore@gmail.com> | 2015-11-25 19:59:38 +0200 |
---|---|---|
committer | Claudiu Popa <pcmanticore@gmail.com> | 2015-11-25 19:59:38 +0200 |
commit | f086f414bb421aaa384b70526cfee211ac067215 (patch) | |
tree | 1534a9bce9b27b1d36062f79149e330e8f1e3bc8 | |
parent | 66c39e1cd94b7deaa90550d63b0b4708338c20b4 (diff) | |
download | pylint-f086f414bb421aaa384b70526cfee211ac067215.tar.gz |
Make some imports external instead of considering them local
The assumption that a module which can't be imported is local
rather than external isn't always correct, since the implementation
of the astroid's import system should always find a module
which is local in the current package, while it isn't necessary
true that it can find always external modules, which just might
be missing.
-rw-r--r-- | pylint/checkers/imports.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/pylint/checkers/imports.py b/pylint/checkers/imports.py index f1fe7c8..dea6523 100644 --- a/pylint/checkers/imports.py +++ b/pylint/checkers/imports.py @@ -360,7 +360,7 @@ given file (report RP0402 must not be disabled)'} return if not isinstance(node.parent, astroid.Module): return - for _ in node.nodes_of_class((astroid.Import, astroid.ImportFrom)): + if any(node.nodes_of_class((astroid.Import, astroid.ImportFrom))): return self._first_non_import_node = node @@ -419,10 +419,10 @@ given file (report RP0402 must not be disabled)'} try: filename = file_from_modpath([package]) except ImportError: - local_imports.append((node, package)) + extern_imports.append((node, package)) continue if not filename: - local_imports.append((node, package)) + extern_imports.append((node, package)) continue filename = os.path.normcase(os.path.abspath(filename)) if not any(filename.startswith(path) for path in stdlib_paths): |