changeset 29207:a09098c61fea

import-checker: always build a list of imported symbols The next patch will rely on it.
author Yuya Nishihara <yuya@tcha.org>
date Sat, 14 May 2016 13:20:13 +0900
parents 0ec8501af800
children cba8bc11ed10
files contrib/import-checker.py
diffstat 1 files changed, 7 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- 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)