From 2f778241a378ba82ecbf819c021b4a1cce86caaa Mon Sep 17 00:00:00 2001 From: Joe Gordon Date: Mon, 25 Feb 2013 17:00:38 -0800 Subject: Fix hacking.py to handle parenthesise in from import as Fix bug 1133070 Support 'from os import (path as p)' Change-Id: Ie2e5b3150efb6f47b16978f3de64fca37e1717a6 --- tools/hacking.py | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'tools') diff --git a/tools/hacking.py b/tools/hacking.py index 1279e87e9..cfd8b8ffc 100755 --- a/tools/hacking.py +++ b/tools/hacking.py @@ -176,9 +176,12 @@ def nova_import_rules(logical_line): Examples: Okay: from os import path + Okay: from os import path as p + Okay: from os import (path as p) Okay: import os.path Okay: from nova.compute import rpcapi N302: from os.path import dirname as dirname2 + N302: from os.path import (dirname as dirname2) N303: from os.path import * N304: from .compute import rpcapi """ @@ -186,6 +189,7 @@ def nova_import_rules(logical_line): # pass the doctest, since the relativity depends on the file's locality def is_module_for_sure(mod, search_path=sys.path): + mod = mod.replace('(', '') # Ignore parentheses try: mod_name = mod while '.' in mod_name: -- cgit