Merge lp:~smoser/maas-images/trunk.flake8 into lp:maas-images

Proposed by Scott Moser
Status: Merged
Merged at revision: 401
Proposed branch: lp:~smoser/maas-images/trunk.flake8
Merge into: lp:maas-images
Diff against target: 79 lines (+13/-8)
3 files modified
meph2/commands/dpkg.py (+2/-2)
meph2/commands/meph2_util.py (+1/-1)
meph2/util.py (+10/-5)
To merge this branch: bzr merge lp:~smoser/maas-images/trunk.flake8
Reviewer Review Type Date Requested Status
Lee Trager (community) Approve
Review via email: mp+348489@code.launchpad.net

Commit message

flake8: fix flake8 errors.

current versions of flake8 as seen in 'tox -e flake8' are complaining
about bare except and a line-too-long. This fixes all those
complaints.

To post a comment you must log in.
Revision history for this message
Lee Trager (ltrager) wrote :

LGTM! Thanks for fixing the errors.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'meph2/commands/dpkg.py'
--- meph2/commands/dpkg.py 2018-05-04 17:10:58 +0000
+++ meph2/commands/dpkg.py 2018-06-25 19:16:11 +0000
@@ -125,8 +125,8 @@
125 if package is None or dpkg_a_newer_than_b(125 if package is None or dpkg_a_newer_than_b(
126 packages[pkg_name]['Version'], package['Version']):126 packages[pkg_name]['Version'], package['Version']):
127 package = packages[pkg_name]127 package = packages[pkg_name]
128 sys.stderr.write(128 sys.stderr.write('Found %s-%s in %s\n' %
129 'Found %s-%s in %s\n' % (pkg_name, package['Version'], dist))129 (pkg_name, package['Version'], dist))
130 # Download it if it was found and a dest was set130 # Download it if it was found and a dest was set
131 if package is not None and dest is not None:131 if package is not None and dest is not None:
132 pkg_data = geturl('%s/%s' % (archive, package['Filename']))132 pkg_data = geturl('%s/%s' % (archive, package['Filename']))
133133
=== modified file 'meph2/commands/meph2_util.py'
--- meph2/commands/meph2_util.py 2017-02-11 01:29:31 +0000
+++ meph2/commands/meph2_util.py 2018-06-25 19:16:11 +0000
@@ -390,7 +390,7 @@
390 reaped.add(orphan)390 reaped.add(orphan)
391 try:391 try:
392 os.removedirs(os.path.dirname(location))392 os.removedirs(os.path.dirname(location))
393 except:393 except OSError:
394 pass394 pass
395395
396 if not args.dry_run:396 if not args.dry_run:
397397
=== modified file 'meph2/util.py'
--- meph2/util.py 2016-10-07 02:51:20 +0000
+++ meph2/util.py 2018-06-25 19:16:11 +0000
@@ -29,6 +29,11 @@
29import sys29import sys
30import tempfile30import tempfile
3131
32try:
33 JSONDecodeError = json.decoder.JSONDecodeError
34except AttributeError:
35 JSONDecodeError = ValueError
36
32# for callers convenience37# for callers convenience
33timestamp = sutil.timestamp38timestamp = sutil.timestamp
3439
@@ -159,7 +164,7 @@
159 with open(filename) as orphan_file:164 with open(filename) as orphan_file:
160 known_orphans = json.load(orphan_file)165 known_orphans = json.load(orphan_file)
161 return known_orphans166 return known_orphans
162 except:167 except JSONDecodeError:
163 raise Exception(168 raise Exception(
164 '%s exists but is not a valid orphan file' % filename169 '%s exists but is not a valid orphan file' % filename
165 )170 )
@@ -181,8 +186,8 @@
181 with open(filename, 'w') as orphan_file:186 with open(filename, 'w') as orphan_file:
182 json.dump(orphans, orphan_file, indent=1)187 json.dump(orphans, orphan_file, indent=1)
183 orphan_file.write("\n")188 orphan_file.write("\n")
184 except:189 except Exception as exc:
185 raise Exception('Cannot write orphan file %s' % filename)190 raise Exception('Cannot write orphan file %s: %s' % (filename, exc))
186191
187192
188def empty_iid_products(content_id):193def empty_iid_products(content_id):
@@ -232,14 +237,14 @@
232 if summer.check():237 if summer.check():
233 try:238 try:
234 os.rename(tf.name, path)239 os.rename(tf.name, path)
235 except:240 except OSError:
236 os.unlink(tf.name)241 os.unlink(tf.name)
237 raise242 raise
238 else:243 else:
239 found = summer.hexdigest()244 found = summer.hexdigest()
240 try:245 try:
241 size = os.path.getsize(tf.name)246 size = os.path.getsize(tf.name)
242 except:247 except OSError:
243 size = "unavailable"248 size = "unavailable"
244 os.unlink(tf.name)249 os.unlink(tf.name)
245250

Subscribers

People subscribed via source and target branches