# HG changeset patch # User Yuya Nishihara # Date 1463199613 -32400 # Node ID a09098c61feaad147bfe851956f549ae8a15b5e6 # Parent 0ec8501af80004a52193d7c450666e5c92dd2fa5 import-checker: always build a list of imported symbols The next patch will rely on it. diff -r 0ec8501af800 -r a09098c61fea contrib/import-checker.py --- 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)