1
From 54ad73dd9a9cf429e36d4a5288206adb308aa367 Mon Sep 17 00:00:00 2001
2
From: Joe Gordon <jogo@cloudscaling.com>
3
Date: Mon, 9 Jul 2012 16:03:14 -0700
4
Subject: [PATCH] Update tools hacking for pep8 1.2 and beyond
6
Based on https://github.com/jcrocholl/pep8/commit/b9f72b16011aac981ce9e3a47fd0ffb1d3d2e085
8
Change-Id: Icd776edd1d7b9987833167dcf04015109ffc7c17
10
tools/hacking.py | 12 +++++++-----
11
tools/test-requires | 2 +-
13
3 files changed, 10 insertions(+), 8 deletions(-)
15
Index: nova-2012.2/tools/hacking.py
16
===================================================================
17
--- nova-2012.2.orig/tools/hacking.py 2012-08-06 12:23:06.000000000 -0700
18
+++ nova-2012.2/tools/hacking.py 2012-08-06 12:23:40.621307381 -0700
22
if logical_line.startswith("except:"):
23
- return 6, "NOVA N201: no 'except:' at least use 'except Exception:'"
24
+ yield 6, "NOVA N201: no 'except:' at least use 'except Exception:'"
27
def nova_except_format_assert(logical_line):
31
if logical_line.startswith("self.assertRaises(Exception"):
32
- return 1, "NOVA N202: assertRaises Exception too broad"
33
+ yield 1, "NOVA N202: assertRaises Exception too broad"
36
def nova_one_import_per_line(logical_line):
38
if (pos > -1 and (parts[0] == "import" or
39
parts[0] == "from" and parts[2] == "import") and
40
not is_import_exception(parts[1])):
41
- return pos, "NOVA N301: one import per line"
42
+ yield pos, "NOVA N301: one import per line"
44
_missingImport = set([])
47
(len(split_line) == 2 or
48
(len(split_line) == 4 and split_line[2] == "as"))):
50
- return importModuleCheck(mod)
51
+ rval = importModuleCheck(mod)
55
# TODO(jogo) handle "from x import *"
60
except LocalizationError as e:
64
#TODO(jogo) Dict and list objects
66
Index: nova-2012.2/tools/test-requires
67
===================================================================
68
--- nova-2012.2.orig/tools/test-requires 2012-08-06 12:23:06.000000000 -0700
69
+++ nova-2012.2/tools/test-requires 2012-08-06 12:23:40.621307381 -0700
73
openstack.nose_plugin>=0.7
77
Index: nova-2012.2/tox.ini
78
===================================================================
79
--- nova-2012.2.orig/tox.ini 2012-08-06 12:23:06.000000000 -0700
80
+++ nova-2012.2/tox.ini 2012-08-06 12:24:27.929305640 -0700
82
downloadcache = ~/cache/pip
88
- python tools/hacking.py --ignore=N4 --repeat --show-source \
89
+ python tools/hacking.py --ignore=N4,E12 --repeat --show-source \
90
--exclude=.venv,.tox,dist,doc,*openstack/common*,*lib/python*,*egg .