import-checker: always build a list of imported symbols
The next patch will rely on it.
--- a/contrib/import-checker.py Sat May 14 13:49:46 2016 +0900
+++ b/contrib/import-checker.py Sat May 14 13:20:13 2016 +0900
@@ -456,15 +456,14 @@
# Direct symbol import is only allowed from certain modules and
# must occur before non-symbol imports.
+ found = fromlocal(node.module, node.level)
+ if found and found[2]: # node.module is a package
+ prefix = found[0] + '.'
+ symbols = [n.name for n in node.names
+ if not fromlocal(prefix + n.name)]
+ else:
+ symbols = [n.name for n in node.names]
if node.module and node.col_offset == root_col_offset:
- found = fromlocal(node.module, node.level)
- if found and found[2]: # node.module is a package
- prefix = found[0] + '.'
- symbols = [n.name for n in node.names
- if not fromlocal(prefix + n.name)]
- else:
- symbols = [n.name for n in node.names]
-
if symbols and fullname not in allowsymbolimports:
yield msg('direct symbol import %s from %s',
', '.join(symbols), fullname)