summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2013-02-27 00:39:28 +0000
committerGerrit Code Review <review@openstack.org>2013-02-27 00:39:28 +0000
commit40be4c6ba0579a9fb3f90c66055db1f1fef69732 (patch)
tree95307a1783fb4ad652727c9cdce838e75e211dba
parent0f3e9f475d558a58afd3299829af4b918258ca45 (diff)
parent2f778241a378ba82ecbf819c021b4a1cce86caaa (diff)
Merge "Fix hacking.py to handle parenthesise in from import as"
-rwxr-xr-xtools/hacking.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/tools/hacking.py b/tools/hacking.py
index 5b301d540..dbb4fbe79 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: