diff options
author | Lars Wirzenius <liw@liw.fi> | 2016-03-17 14:15:26 +0200 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2016-03-17 14:15:26 +0200 |
commit | eec9750c81f0ba15a9d1a43efbdb85b3211f2daa (patch) | |
tree | a6445e78a3a0aeca14b89e39bbdc0d9b1fe19979 | |
parent | f003f7cbacb16642739fb7f1e9602dde912060f6 (diff) | |
download | obnam-eec9750c81f0ba15a9d1a43efbdb85b3211f2daa.tar.gz |
Do union only once
-rw-r--r-- | obnamlib/fmt_ga/client.py | 11 |
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() |