diff options
author | Lars Wirzenius <liw@liw.fi> | 2016-01-15 16:37:18 +0200 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2016-01-15 17:16:28 +0200 |
commit | 8e6b1f6c54a6573d4e25b8c556256ee6a2f9881c (patch) | |
tree | 3a45f1880fcc207b151141ba8084eca89efbb083 | |
parent | d6911fb7f2514036c7c49d342561ca421a629cf4 (diff) | |
download | obnam-8e6b1f6c54a6573d4e25b8c556256ee6a2f9881c.tar.gz |
Use enumerate for clarity, brevity
-rw-r--r-- | obnamlib/blob_store.py | 3 | ||||
-rw-r--r-- | obnamlib/plugins/show_plugin.py | 4 |
2 files changed, 3 insertions, 4 deletions
diff --git a/obnamlib/blob_store.py b/obnamlib/blob_store.py index a457483a..11eca316 100644 --- a/obnamlib/blob_store.py +++ b/obnamlib/blob_store.py @@ -45,8 +45,7 @@ class BlobStore(object): return self._cached_blobs.get(blob_id) if self._bag_store.has_bag(bag_id): bag = self._bag_store.get_bag(bag_id) - for i in range(len(bag)): - this_blob = bag[i] + for i, this_blob in enumerate(bag): this_id = obnamlib.make_object_id(bag_id, i) self._cached_blobs.put(this_id, this_blob) return bag[index] diff --git a/obnamlib/plugins/show_plugin.py b/obnamlib/plugins/show_plugin.py index c2f8aa02..8f953739 100644 --- a/obnamlib/plugins/show_plugin.py +++ b/obnamlib/plugins/show_plugin.py @@ -263,12 +263,12 @@ class ShowPlugin(obnamlib.ObnamPlugin): ] result = [] - for i in range(len(fields)): + for i, field in enumerate(fields): if widths[i] < 0: fmt = '%-*s' else: fmt = '%*s' - result.append(fmt % (abs(widths[i]), fields[i])) + result.append(fmt % (abs(widths[i]), field)) self.app.output.write('%s\n' % ' '.join(result)) def kdirstat(self, args): |