diff --git a/contrib/import-checker.py b/contrib/import-checker.py index 1651977596c008cce8a697f7e0277c4aff366ea8_Y29udHJpYi9pbXBvcnQtY2hlY2tlci5weQ==..d02888308235491f2511116a269058e577e895d3_Y29udHJpYi9pbXBvcnQtY2hlY2tlci5weQ== 100755 --- a/contrib/import-checker.py +++ b/contrib/import-checker.py @@ -24,6 +24,9 @@ 'mercurial.node', ) +# Whitelist of symbols that can be directly imported. +directsymbols = () + # Modules that must be aliased because they are commonly confused with # common variables and can create aliasing and readability issues. requirealias = { @@ -464,6 +467,6 @@ 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)] + symbols = (n.name for n in node.names + if not fromlocal(prefix + n.name)) else: @@ -469,5 +472,6 @@ else: - symbols = [n.name for n in node.names] + symbols = (n.name for n in node.names) + symbols = [sym for sym in symbols if sym not in directsymbols] if node.module and node.col_offset == root_col_offset: if symbols and fullname not in allowsymbolimports: yield msg('direct symbol import %s from %s',