summaryrefslogtreecommitdiff
path: root/pylint/checkers/imports.py
diff options
context:
space:
mode:
authorNick Drozd <nicholasdrozd@gmail.com>2019-10-21 01:29:43 -0500
committerClaudiu Popa <pcmanticore@gmail.com>2019-10-21 08:29:42 +0200
commit97f4f2ae187df933f072d74fd8347ec14213f5de (patch)
tree93c19202c6ab671a2152c4e0ed4cb08b99798efb /pylint/checkers/imports.py
parent86d281103cfac49f7ca9df7c4b23baf70ac8d439 (diff)
downloadpylint-git-97f4f2ae187df933f072d74fd8347ec14213f5de.tar.gz
import-outside-toplevel: Show full names for ImportFrom nodes (#3207)
This is a little more informative than just showing the module name.
Diffstat (limited to 'pylint/checkers/imports.py')
-rw-r--r--pylint/checkers/imports.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/pylint/checkers/imports.py b/pylint/checkers/imports.py
index 42d4362df..dea131c61 100644
--- a/pylint/checkers/imports.py
+++ b/pylint/checkers/imports.py
@@ -960,10 +960,12 @@ class ImportsChecker(BaseChecker):
if isinstance(node.scope(), astroid.Module):
return
- if isinstance(node, astroid.ImportFrom):
- module_names = [node.modname]
- else:
- module_names = [name[0] for name in node.names]
+ module_names = [
+ "{}.{}".format(node.modname, name[0])
+ if isinstance(node, astroid.ImportFrom)
+ else name[0]
+ for name in node.names
+ ]
# Get the full names of all the imports that are not whitelisted.
scoped_imports = [