From 70deda41d302c45e394fde03d4db02f6bb877e38 Mon Sep 17 00:00:00 2001 From: Lars Wirzenius Date: Sun, 12 Feb 2017 17:16:05 +0200 Subject: Update copyright years; reformat to pacify pep8, pylint --- obnam.1.in | 2 +- obnamlib/fmt_ga/client.py | 25 +++++++++++++++++-------- obnamlib/plugins/forget_plugin.py | 5 +++-- obnamlib/plugins/restore_plugin.py | 2 +- 4 files changed, 22 insertions(+), 12 deletions(-) diff --git a/obnam.1.in b/obnam.1.in index f2e4599c..52ef7c76 100644 --- a/obnam.1.in +++ b/obnam.1.in @@ -1,4 +1,4 @@ -.\" Copyright 2010-2016 Lars Wirzenius +.\" Copyright 2010-2017 Lars Wirzenius .\" .\" This program is free software: you can redistribute it and/or modify .\" it under the terms of the GNU General Public License as published by diff --git a/obnamlib/fmt_ga/client.py b/obnamlib/fmt_ga/client.py index 7ec4b9c3..f5fcfba9 100644 --- a/obnamlib/fmt_ga/client.py +++ b/obnamlib/fmt_ga/client.py @@ -1,4 +1,4 @@ -# Copyright 2015-2016 Lars Wirzenius +# Copyright 2015-2017 Lars Wirzenius # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -229,12 +229,17 @@ class GAClient(object): 'memory-dump-interval': 0, }) self._dumper = dumper + chunks_in_removed = self.get_generation_chunk_ids(gen_number) dumper.dump_memory_profile('after getting chunks in removed gen') + chunks_remaining = self._get_chunk_ids_used_by_generations(remaining) - dumper.dump_memory_profile('after getting chunks in remaining generations') + dumper.dump_memory_profile( + 'after getting chunks in remaining generations') + unused_chunks = set(chunks_in_removed).difference(chunks_remaining) - dumper.dump_memory_profile('after getting computing set of chunks to remove') + dumper.dump_memory_profile( + 'after getting computing set of chunks to remove') self._generations.set_generations(remaining) @@ -386,7 +391,8 @@ class GAClient(object): if hasattr(self, '_dumper'): dump = self._dumper.dump_memory_profile else: - dump = lambda s: None + def dump(msg): + return None dump('before getting chunk ids used by genaration') self._load_data() dump('after loading data') @@ -395,11 +401,14 @@ class GAClient(object): metadata = generation.get_file_metadata() dump('after getting file metadata for generation') - union = set() - for filename in metadata: - union = union.union(set(metadata.get_file_chunk_ids(filename))) - + sets = [ + set(metadata.get_file_chunk_ids(filename)) + for filename in metadata + ] + dump('after building list of sets of chunkids used by files') + union = set().union(*sets) dump('after building union of sets') + result = list(union) dump('after constructing result') return result diff --git a/obnamlib/plugins/forget_plugin.py b/obnamlib/plugins/forget_plugin.py index 66bd6dc2..42f30e97 100644 --- a/obnamlib/plugins/forget_plugin.py +++ b/obnamlib/plugins/forget_plugin.py @@ -1,4 +1,4 @@ -# Copyright (C) 2010-2016 Lars Wirzenius +# Copyright (C) 2010-2017 Lars Wirzenius # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -96,7 +96,8 @@ class ForgetPlugin(obnamlib.ObnamPlugin): for genid in removeids: self.app.ts['gen'] = genid chunk_ids = self.remove(genid) - self.app.dump_memory_profile('after marking gen for removal (about to remove chunks)') + self.app.dump_memory_profile( + 'after marking gen for removal (about to remove chunks)') for unused_chunk_id in chunk_ids: self.repo.remove_chunk_from_indexes( unused_chunk_id, client_name) diff --git a/obnamlib/plugins/restore_plugin.py b/obnamlib/plugins/restore_plugin.py index bf539b5f..7075f82c 100644 --- a/obnamlib/plugins/restore_plugin.py +++ b/obnamlib/plugins/restore_plugin.py @@ -1,4 +1,4 @@ -# Copyright (C) 2009-2016 Lars Wirzenius +# Copyright (C) 2009-2017 Lars Wirzenius # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by -- cgit v1.2.1