diff options
author | Lars Wirzenius <liw@liw.fi> | 2015-11-17 17:40:57 +0000 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2015-11-17 20:36:56 +0000 |
commit | 16ece88991f1c36986741604389c383ebc5cc129 (patch) | |
tree | 418d89a70be6b3a52cc4ee5fd99b6a5cbbbc5ca7 | |
parent | e1bac223c54f8f0c3c41e026623eab209dd3f095 (diff) | |
download | obnam-16ece88991f1c36986741604389c383ebc5cc129.tar.gz |
Move _prepare_data into _load_data
-rw-r--r-- | obnamlib/fmt_ga/indexes.py | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/obnamlib/fmt_ga/indexes.py b/obnamlib/fmt_ga/indexes.py index 9985061e..2f204645 100644 --- a/obnamlib/fmt_ga/indexes.py +++ b/obnamlib/fmt_ga/indexes.py @@ -59,7 +59,6 @@ class GAChunkIndexes(object): def put_chunk_into_indexes(self, chunk_id, token, client_id): self._load_data() - self._prepare_data() self._data['index'].append({ 'chunk-id': chunk_id, 'sha512': token, @@ -74,13 +73,11 @@ class GAChunkIndexes(object): self._data = obnamlib.deserialise_object(blob) assert self._data is not None else: - self._data = {} + self._data = { + 'index': [], + } self._data_is_loaded = True - def _prepare_data(self): - if 'index' not in self._data: - self._data['index'] = [] - def find_chunk_ids_by_content(self, chunk_content): self._load_data() if 'index' in self._data: @@ -98,8 +95,6 @@ class GAChunkIndexes(object): def remove_chunk_from_indexes(self, chunk_id, client_id): self._load_data() - self._prepare_data() - self._data['index'] = self._filter_out( self._data['index'], lambda x: @@ -110,8 +105,6 @@ class GAChunkIndexes(object): def remove_chunk_from_indexes_for_all_clients(self, chunk_id): self._load_data() - self._prepare_data() - self._data['index'] = self._filter_out( self._data['index'], lambda x: x['chunk-id'] == chunk_id) |