summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2015-11-17 17:47:51 +0000
committerLars Wirzenius <liw@liw.fi>2015-11-17 17:47:51 +0000
commit5af7e9778d1565cce5390633e22ffde9207a1584 (patch)
tree9c6be061bbe800d18a532f0a99b6848767376b01
parent636f5ab066a7f69a778d960db91827d21a0fd3df (diff)
downloadobnam-5af7e9778d1565cce5390633e22ffde9207a1584.tar.gz
Simplify find_chunk_ids_by_content
There's really no reason to treat the empty case specially.
-rw-r--r--obnamlib/fmt_ga/indexes.py13
1 files changed, 4 insertions, 9 deletions
diff --git a/obnamlib/fmt_ga/indexes.py b/obnamlib/fmt_ga/indexes.py
index 2f204645..8a2ed4a3 100644
--- a/obnamlib/fmt_ga/indexes.py
+++ b/obnamlib/fmt_ga/indexes.py
@@ -80,15 +80,10 @@ class GAChunkIndexes(object):
def find_chunk_ids_by_content(self, chunk_content):
self._load_data()
- if 'index' in self._data:
- token = self.prepare_chunk_for_indexes(chunk_content)
- result = [
- record['chunk-id']
- for record in self._data['index']
- if record['sha512'] == token]
- else:
- result = []
-
+ token = self.prepare_chunk_for_indexes(chunk_content)
+ result = [record['chunk-id']
+ for record in self._data['index']
+ if record['sha512'] == token]
if not result:
raise obnamlib.RepositoryChunkContentNotInIndexes()
return result