summaryrefslogtreecommitdiff
path: root/tools/hacking.py
diff options
context:
space:
mode:
authorRyan Harper <ryan.harper@canonical.com>2016-03-03 17:16:13 -0600
committerRyan Harper <ryan.harper@canonical.com>2016-03-03 17:16:13 -0600
commit63357ed731710b2418810535d9c991adbaea8dcb (patch)
tree5c553b0671669beb204c4edb3d82ebeda78d7cd3 /tools/hacking.py
parentb1046db66bbed6a063f218992449b8abfd1ae99b (diff)
parent3d9153d16b194e7a3139c290e723ef17518e617d (diff)
downloadvyos-cloud-init-63357ed731710b2418810535d9c991adbaea8dcb.tar.gz
vyos-cloud-init-63357ed731710b2418810535d9c991adbaea8dcb.zip
Apply pep8, pyflakes fixes for python2 and 3
Update make check target to use pep8, pyflakes, pyflakes3.
Diffstat (limited to 'tools/hacking.py')
-rwxr-xr-xtools/hacking.py16
1 files changed, 8 insertions, 8 deletions
diff --git a/tools/hacking.py b/tools/hacking.py
index 3175df38..1a0631c2 100755
--- a/tools/hacking.py
+++ b/tools/hacking.py
@@ -47,10 +47,10 @@ def import_normalize(line):
# handle "from x import y as z" to "import x.y as z"
split_line = line.split()
if (line.startswith("from ") and "," not in 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"))):
+ 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"))):
return "import %s.%s" % (split_line[1], split_line[3])
else:
return line
@@ -74,7 +74,7 @@ def cloud_import_alphabetical(physical_line, line_number, lines):
split_line[0] == "import" and split_previous[0] == "import"):
if split_line[1] < split_previous[1]:
return (0, "N306: imports not in alphabetical order (%s, %s)"
- % (split_previous[1], split_line[1]))
+ % (split_previous[1], split_line[1]))
def cloud_docstring_start_space(physical_line):
@@ -87,8 +87,8 @@ def cloud_docstring_start_space(physical_line):
pos = max([physical_line.find(i) for i in DOCSTRING_TRIPLE]) # start
if (pos != -1 and len(physical_line) > pos + 1):
if (physical_line[pos + 3] == ' '):
- return (pos, "N401: one line docstring should not start with"
- " a space")
+ return (pos,
+ "N401: one line docstring should not start with a space")
def cloud_todo_format(physical_line):
@@ -167,4 +167,4 @@ if __name__ == "__main__":
finally:
if len(_missingImport) > 0:
print >> sys.stderr, ("%i imports missing in this test environment"
- % len(_missingImport))
+ % len(_missingImport))