summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2016-03-17 14:15:26 +0200
committerLars Wirzenius <liw@liw.fi>2016-03-17 14:15:26 +0200
commiteec9750c81f0ba15a9d1a43efbdb85b3211f2daa (patch)
treea6445e78a3a0aeca14b89e39bbdc0d9b1fe19979
parentf003f7cbacb16642739fb7f1e9602dde912060f6 (diff)
downloadobnam-eec9750c81f0ba15a9d1a43efbdb85b3211f2daa.tar.gz
Do union only once
-rw-r--r--obnamlib/fmt_ga/client.py11
1 files changed, 6 insertions, 5 deletions
diff --git a/obnamlib/fmt_ga/client.py b/obnamlib/fmt_ga/client.py
index 1bfe1dc1..8ea4b549 100644
--- a/obnamlib/fmt_ga/client.py
+++ b/obnamlib/fmt_ga/client.py
@@ -352,13 +352,14 @@ class GAClient(object):
def get_generation_chunk_ids(self, gen_number):
self._load_data()
- chunk_ids = set()
generation = self._lookup_generation_by_gen_number(gen_number)
metadata = generation.get_file_metadata()
- for filename in metadata:
- file_chunk_ids = metadata.get_file_chunk_ids(filename)
- chunk_ids = chunk_ids.union(set(file_chunk_ids))
- return list(chunk_ids)
+ sets = [
+ set(metadata.get_file_chunk_ids(filename))
+ for filename in metadata
+ ]
+ union = set().union(*sets)
+ return list(union)
def get_file_children(self, gen_number, filename):
self._load_data()