HACKING fixes, all but sqlalchemy.

Looks like this fixes all HACKING problems that were around.
Thanks to Dina Belova and Alexander Kovalev for this work.

Change-Id: I8157f0d4890184c1216aab63ef7180ee8b7a184d
This commit is contained in:
Yuriy Taraday
2012-03-06 12:53:07 +04:00
parent d8324bb3d0
commit 01a938f7fe
67 changed files with 387 additions and 370 deletions

View File

@@ -1,3 +1,4 @@
#!/usr/bin/env python
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (c) 2012, Cloudscaling
@@ -24,10 +25,10 @@ import inspect
import os
import re
import sys
import traceback
import pep8
#N1xx comments
#N2xx except
#N3xx imports
@@ -118,14 +119,14 @@ def nova_import_module_only(logical_line):
return logical_line.find(mod), ("NOVA N302: import only "
"modules. '%s' does not import a module" % logical_line)
except (ImportError, NameError):
except (ImportError, NameError) as exc:
if not added:
added = True
sys.path.append(current_path)
return importModuleCheck(mod, parent, added)
else:
print >> sys.stderr, ("ERROR: import '%s' failed, couldn't "
"find module" % logical_line)
print >> sys.stderr, ("ERROR: import '%s' failed: %s" %
(logical_line, exc))
added = False
sys.path.pop()
return
@@ -149,6 +150,7 @@ def nova_import_module_only(logical_line):
# handle "from x import y as z"
elif (logical_line.startswith("from ") and "," not in logical_line and
split_line[2] == "import" and split_line[3] != "*" and
split_line[1] != "__future__" and
(len(split_line) == 4 or
(len(split_line) == 6 and split_line[4] == "as"))):
mod = split_line[3]