Skip to content

Commit 4b06a01

Browse files
authored
Fixed lint errors (#23)
1 parent 9c8aced commit 4b06a01

File tree

10 files changed

+30
-28
lines changed

10 files changed

+30
-28
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ TESTER = ./venv/bin/nosetests
44
LINTER = ./venv/bin/flake8
55

66
.PHONY: all
7-
all: venv test
7+
all: venv lint test
88
@echo Done.
99

1010
.PHONY: lint

clients/logging/__init__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,16 +82,16 @@ def __call__(self, event_info):
8282
'Unhandled exception in deferred',
8383
failure=str(event_info['failure']).replace('\n', '\n\r'),
8484
traceback=str(event_info['failure'].getBriefTraceback()).replace('\n', '\n\r'))
85-
except:
85+
except Exception:
8686
pass
8787

8888
try:
8989
if len(event_info['message']) > 0:
9090
self.logger_instance.error(
9191
str(event_info['message']).replace('\n', '\n\r'))
92-
except:
92+
except Exception:
9393
pass
94-
except:
94+
except Exception:
9595
pass
9696

9797

clients/logging/formatter/helpers.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ class ObjectEncoder(simplejson.JSONEncoder):
3838
def default(self, obj):
3939
try:
4040
return obj.__log__()
41-
except:
41+
except Exception:
4242
return obj.__repr__()
4343

4444

@@ -50,7 +50,7 @@ def format_to_json_str(params):
5050

5151
# default encoding is utf8
5252
return simplejson.dumps(params, cls=ObjectEncoder)
53-
except:
53+
except Exception:
5454

5555
# this is the widest complementary encoding found
5656
return simplejson.dumps(params, cls=ObjectEncoder, encoding='raw_unicode_escape')

clients/logging/formatter/human_readable.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ def _get_what_color():
7171
time_parts = output['when'].split('.')
7272
time_parts[-1] = time_parts[-1][:-3]
7373
output['when'] = '.'.join(time_parts)
74-
except:
74+
except Exception:
7575
pass
7676

7777
# Disable coloring if requested

clients/logging/formatter/json.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ def format(self, record):
1515
more = dict(record.vars) if len(record.vars) else {}
1616
try:
1717
del more['ctx']
18-
except:
18+
except Exception:
1919
pass
2020
except Exception as exc:
2121
more = 'Record vars are not parsable: {0}'.format(str(exc))

core/__init__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -353,6 +353,6 @@ def _get_next_dependent_target(self, parent_target):
353353
def _enforce_no_store_true_args(parser):
354354
for action in parser._actions:
355355
if isinstance(action, argparse._StoreTrueAction):
356-
raise SyntaxError('manofest.py doens\'t support argument registration of type=\'store_true\' \n' + \
357-
'offending action={0}'.format(action))
358-
356+
error_msg = 'manofest.py doens\'t support argument registration of type=\'store_true\' \n' + \
357+
'offending action={0}'.format(action)
358+
raise SyntaxError(error_msg)

manof.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,9 @@ def _register_arguments(parser):
5151
clients.logging.Client.register_arguments(parser)
5252

5353
parser.add_argument(
54-
'-mp', '--manofest-path',
55-
help='Location of manofest.py',
56-
default='manofest.py')
54+
'-mp', '--manofest-path',
55+
help='Location of manofest.py',
56+
default='manofest.py')
5757

5858
parser.add_argument(
5959
'--num-retries',
@@ -64,14 +64,14 @@ def _register_arguments(parser):
6464

6565
# don't actually run any commands
6666
parser.add_argument(
67-
'-dr', '--dry-run',
68-
help='Don\'t actually run any commands, just log',
69-
action='store_true')
67+
'-dr', '--dry-run',
68+
help='Don\'t actually run any commands, just log',
69+
action='store_true')
7070

7171
parser.add_argument('-p', '--parallel', action='store', help='Set how many commands to run in parallel', type=int)
7272

7373
# update
74-
update_command = subparsers.add_parser('update', help='Updates Manof')
74+
subparsers.add_parser('update', help='Updates Manof')
7575

7676
# provision
7777
provision_command = subparsers.add_parser('provision', help='Build or pull target images')
@@ -98,7 +98,7 @@ def _register_arguments(parser):
9898
action='append',
9999
dest='devices')
100100
run_parent_parser.add_argument('--device-cgroup-rule',
101-
help='Add a rule to the cgroup allowed devices list (e.g. c\ 42:*\ rmw)')
101+
help='Add a rule to the cgroup allowed devices list (e.g. c 42:* rmw)')
102102
run_parent_parser \
103103
.add_argument('--device-read-bps',
104104
help='Limit read rate (bytes per second) from a device (e.g. /dev/sda:50mb)')

manof/__init__.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
# to allow manofests to use manof.Image and such rather than manof.image.Image
2-
from target import *
3-
from image import *
4-
from volume import *
5-
from group import *
6-
2+
from target import Target
3+
from image import Image
4+
from volume import Volume, NamedVolume
5+
from group import Group

manof/image.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ def provision(self):
5151
# whatever happens, delete docker ignore silently
5252
try:
5353
os.remove(dockerignore_path)
54-
except:
54+
except Exception:
5555
pass
5656
else:
5757

@@ -687,7 +687,9 @@ def to_dict(self):
687687
return d
688688

689689
def _update_env_override(self):
690-
""" Set all the env related args we registered to environment """
690+
"""
691+
Set all the env related args we registered to environment
692+
"""
691693
env = self.env
692694
for idx, envvar in enumerate(env):
693695
if isinstance(envvar, dict):

manof/utils/__init__.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,8 @@ def venv_run(logger, venv_path, command, cwd=None, quiet=False):
9595

9696
def getProcessOutputAndValue(executable, args=(), env={}, path=None,
9797
reactor=None):
98-
"""Spawn a process and returns a Deferred that will be called back with
98+
"""
99+
Spawn a process and returns a Deferred that will be called back with
99100
its output (from stdout and stderr) and it's exit code as (out, err, code)
100101
If a signal is raised, the Deferred will errback with the stdout and
101102
stderr up to that point, along with the signal, as (out, err, signalNum)
@@ -110,7 +111,7 @@ def _callProtocolWithDeferred(protocol, executable, args, env, path, reactor=Non
110111

111112
d = defer.Deferred()
112113
p = protocol(d)
113-
reactor.spawnProcess(p, executable, (executable,)+tuple(args), env, path)
114+
reactor.spawnProcess(p, executable, (executable,) + tuple(args), env, path)
114115
return d
115116

116117

0 commit comments

Comments
 (0)