summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2017-06-12 23:20:09 +0300
committerLars Wirzenius <liw@liw.fi>2017-06-12 23:20:09 +0300
commit150c54489716d473e167ca5c57a3365727762985 (patch)
tree7b79e4791bb009d69dea79778e30c6d326d3691e
parentbf9c06f32f07a0b9ee29d38760ac7e826b66c922 (diff)
downloadobnam-150c54489716d473e167ca5c57a3365727762985.tar.gz
Fix: break long lines, fix stylistic nits
-rw-r--r--obnamlib/backup_progress.py5
-rw-r--r--obnamlib/backup_progress_tests.py2
-rw-r--r--obnamlib/fmt_ga/chunk_store.py2
-rw-r--r--obnamlib/fmt_ga/cowtree.py2
-rw-r--r--obnamlib/fmt_ga/indexes.py26
-rw-r--r--pylint.conf1
6 files changed, 26 insertions, 12 deletions
diff --git a/obnamlib/backup_progress.py b/obnamlib/backup_progress.py
index 026dd604..b9a8f4cb 100644
--- a/obnamlib/backup_progress.py
+++ b/obnamlib/backup_progress.py
@@ -116,7 +116,7 @@ class BackupProgress(object):
def report_stats(self, output, fs, quiet, report=None): # pragma: no cover
if report is None:
report = self.compute_report(fs)
-
+
duration_string = obnamlib.humanise_duration(report['duration'])
chunk_amount, chunk_unit = obnamlib.humanise_size(
@@ -134,7 +134,8 @@ class BackupProgress(object):
overhead_bytes = max(0, overhead_bytes)
overhead_amount, overhead_unit = obnamlib.humanise_size(overhead_bytes)
if report['uploaded-total-bytes'] > 0:
- overhead_percent = 100.0 * overhead_bytes / report['uploaded-total-bytes']
+ overhead_percent = (
+ 100.0 * overhead_bytes / report['uploaded-total-bytes'])
else:
overhead_percent = 0.0
diff --git a/obnamlib/backup_progress_tests.py b/obnamlib/backup_progress_tests.py
index c3d2dc01..7aba84b1 100644
--- a/obnamlib/backup_progress_tests.py
+++ b/obnamlib/backup_progress_tests.py
@@ -103,7 +103,7 @@ class DummyTerminalStatus(object):
def error(self, msg):
pass
-
+
def __setitem__(self, key, value):
pass
diff --git a/obnamlib/fmt_ga/chunk_store.py b/obnamlib/fmt_ga/chunk_store.py
index 709eb00f..5a1796d0 100644
--- a/obnamlib/fmt_ga/chunk_store.py
+++ b/obnamlib/fmt_ga/chunk_store.py
@@ -66,7 +66,7 @@ class GAChunkStore(object):
return content
def get_bag_id(self, chunk_id):
- bag_id, obj_id = obnamlib.parse_object_id(chunk_id)
+ bag_id, _ = obnamlib.parse_object_id(chunk_id)
return bag_id
def get_chunks_in_bag(self, bag_id):
diff --git a/obnamlib/fmt_ga/cowtree.py b/obnamlib/fmt_ga/cowtree.py
index 24093067..933f3b86 100644
--- a/obnamlib/fmt_ga/cowtree.py
+++ b/obnamlib/fmt_ga/cowtree.py
@@ -101,7 +101,7 @@ class CowTree(object):
self._make_split_leaf(leaf, list(sorted(leaf.keys())))
def keys(self):
- leaf_ids = self._leaf_list.leaf_ids()
+ leaf_ids = list(self._leaf_list.leaf_ids())
if leaf_ids:
for leaf_id in leaf_ids:
leaf = self._store.get_leaf(leaf_id)
diff --git a/obnamlib/fmt_ga/indexes.py b/obnamlib/fmt_ga/indexes.py
index 29169bac..9ce8807a 100644
--- a/obnamlib/fmt_ga/indexes.py
+++ b/obnamlib/fmt_ga/indexes.py
@@ -128,7 +128,9 @@ class GAChunkIndexes(object):
self._load_data()
client_ids = self._used_by_tree.lookup(chunk_id)
- logging.debug('xxx before adding to used-by: chunk %r is used by %r', chunk_id, client_ids)
+ logging.debug(
+ 'xxx before adding to used-by: chunk %r is used by %r',
+ chunk_id, client_ids)
self._by_chunk_id_tree.insert(chunk_id, token)
@@ -144,7 +146,9 @@ class GAChunkIndexes(object):
elif client_id not in client_ids:
client_ids.append(client_id)
self._used_by_tree.insert(chunk_id, client_ids)
- logging.debug('xxx after adding to used-by: chunk %r is used by %r', chunk_id, client_ids)
+ logging.debug(
+ 'xxx after adding to used-by: chunk %r is used by %r',
+ chunk_id, client_ids)
def find_chunk_ids_by_token(self, token):
self._load_data()
@@ -168,7 +172,9 @@ class GAChunkIndexes(object):
def _remove_used_by(self, chunk_id, client_id):
still_used = False
client_ids = self._used_by_tree.lookup(chunk_id)
- logging.debug('xxx before removing used_by: chunk %r is used by %r', chunk_id, client_ids)
+ logging.debug(
+ 'xxx before removing used_by: chunk %r is used by %r',
+ chunk_id, client_ids)
if client_ids is not None and client_id in client_ids:
client_ids.remove(client_id)
self._used_by_tree.insert(chunk_id, client_ids)
@@ -178,7 +184,9 @@ class GAChunkIndexes(object):
# We leave an empty list, and use that in
# remove_unused_chunks to indicate an unused chunk.
pass
- logging.debug('xxx after removing used_by: chunk %r is used by %r', chunk_id, client_ids)
+ logging.debug(
+ 'xxx after removing used_by: chunk %r is used by %r',
+ chunk_id, client_ids)
return still_used
def _remove_chunk_by_id(self, chunk_id):
@@ -204,14 +212,18 @@ class GAChunkIndexes(object):
chunk_store, unused_chunks)
for bag_id in maybe_unused_bags:
chunk_ids = chunk_store.get_chunks_in_bag(bag_id)
- logging.debug('remove_unused_chunk: can bag %r be removed?', bag_id)
+ logging.debug(
+ 'remove_unused_chunk: can bag %r be removed?', bag_id)
for chunk_id in chunk_ids:
- logging.debug('remove_unused_chunk: chunk %r, used: %r', chunk_id, self.is_chunk_used_by_anyone(chunk_id))
+ logging.debug(
+ 'remove_unused_chunk: chunk %r, used: %r',
+ chunk_id, self.is_chunk_used_by_anyone(chunk_id))
if not self.any_chunk_is_used_by_someone(chunk_ids):
logging.debug('remove_unused_chunk: remove bag %r', bag_id)
chunk_store.remove_bag(bag_id)
else:
- logging.debug('remove_unused_chunk: bag %r cannot be removed', bag_id)
+ logging.debug(
+ 'remove_unused_chunk: bag %r cannot be removed', bag_id)
def get_unused_chunks(self):
return [
diff --git a/pylint.conf b/pylint.conf
index 146a84ee..e21137e9 100644
--- a/pylint.conf
+++ b/pylint.conf
@@ -15,6 +15,7 @@ disable=
missing-docstring,
no-self-use,
protected-access,
+ redefined-builtin,
redefined-variable-type,
star-args,
too-few-public-methods,