Drop run_midx from client since it's not supported. Fix wrong
idxmerge progress argument. Remove a number of vestigial arguments.
Signed-off-by: Rob Browning <
r...@defaultvalue.org>
Tested-by: Rob Browning <
r...@defaultvalue.org>
---
.pylintrc | 4 ++++
lib/bup/client.py | 10 ++++------
lib/bup/cmd/ftp.py | 2 +-
lib/bup/cmd/get.py | 35 +++++++++++++++--------------------
lib/bup/cmd/index.py | 3 +--
lib/bup/cmd/save.py | 6 +++---
lib/bup/cmd/split.py | 5 ++---
lib/bup/cmd/web.py | 5 ++---
lib/bup/git.py | 2 +-
lib/bup/helpers.py | 2 +-
lib/bup/index.py | 2 +-
lib/bup/metadata.py | 16 ++++++++++------
lib/bup/options.py | 2 +-
lib/bup/protocol.py | 8 ++++----
lib/bup/rewrite.py | 15 ++++++---------
lib/bup/vfs.py | 8 ++++----
test/int/test_bloom.py | 1 +
17 files changed, 61 insertions(+), 65 deletions(-)
diff --git a/.pylintrc b/.pylintrc
index a6d7baed..db88bfc3 100644
--- a/.pylintrc
+++ b/.pylintrc
@@ -1,6 +1,9 @@
# -*-conf-*-
[GENERAL OPTIONS]
+[VARIABLES]
+ignored-argument-names=.*_$
+
[MESSAGES CONTROL]
disable=all
enable=
@@ -51,6 +54,7 @@ enable=
unnecessary-semicolon,
unreachable,
unspecified-encoding,
+ unused-argument,
unused-import,
unused-wildcard-import,
use-dict-literal,
diff --git a/lib/bup/client.py b/lib/bup/client.py
index 56dbf5b6..11547ed8 100644
--- a/lib/bup/client.py
+++ b/lib/bup/client.py
@@ -200,7 +200,7 @@ class Client:
if self._closed:
return
self._closed = True
- def await_ssh(p):
+ def await_ssh(_):
rc = self._proc.wait()
if rc:
raise ClientError(f'server tunnel returned exit code {rc}')
@@ -443,8 +443,7 @@ class Client:
return idx
def new_packwriter(self, compression_level=None,
- max_pack_size=None, max_pack_objects=None,
- run_midx=True):
+ max_pack_size=None, max_pack_objects=None):
self._require_command(b'receive-objects-v2')
self.check_busy()
def set_busy():
@@ -457,8 +456,7 @@ class Client:
suggest_packs=self._suggest_packs,
onopen=set_busy,
onclose=unset_busy,
- ensure_busy=self.ensure_busy,
- run_midx=run_midx)
+ ensure_busy=self.ensure_busy)
return PackWriter(store=store,
compression_level=compression_level,
max_pack_size=max_pack_size,
@@ -612,7 +610,7 @@ class Client:
class RemotePackStore:
def __init__(self, conn, *, cache, suggest_packs, onopen, onclose,
- ensure_busy, run_midx=True):
+ ensure_busy):
self._closed = False
self._bwcount = 0
self._bwtime = time.time()
diff --git a/lib/bup/cmd/ftp.py b/lib/bup/cmd/ftp.py
index bba5a1ce..f5bbc84d 100644
--- a/lib/bup/cmd/ftp.py
+++ b/lib/bup/cmd/ftp.py
@@ -53,7 +53,7 @@ def _completer_get_subs(repo, line):
_attempt_start = None
_attempt_end = None
-def attempt_completion(text, start, end):
+def attempt_completion(text_, start, end):
global _attempt_start, _attempt_end
_attempt_start = start
_attempt_end = end
diff --git a/lib/bup/cmd/get.py b/lib/bup/cmd/get.py
index 103b9922..930ed881 100644
--- a/lib/bup/cmd/get.py
+++ b/lib/bup/cmd/get.py
@@ -295,7 +295,7 @@ def parse_args(args):
# FIXME: walk_object in in git.py doesn't support opt.verbose. Do we
# need to adjust for that here?
-def get_random_item(name, hash, src_repo, dest_repo, ignore_missing):
+def get_random_item(hash, src_repo, dest_repo, ignore_missing):
def already_seen(oid):
return dest_repo.exists(unhexlify(oid))
def get_ref(oidx, include_data=False):
@@ -340,14 +340,14 @@ class GetResult:
repairs: int = 0
-def transfer_commit(name, hash, parent, src_repo, dest_repo, ignore_missing):
+def transfer_commit(hash, parent, src_repo, dest_repo, ignore_missing):
now = time.time()
items = parse_commit(get_cat_data(
src_repo.cat(hash), b'commit'))
tree = unhexlify(items.tree)
author = b'%s <%s>' % (items.author_name, items.author_mail)
author_time = (items.author_sec, items.author_offset)
committer = b'%s <%s@%s>' % (userfullname(), username(), hostname())
- get_random_item(name, hexlify(tree), src_repo, dest_repo, ignore_missing)
+ get_random_item(hexlify(tree), src_repo, dest_repo, ignore_missing)
c = dest_repo.write_commit(tree, parent,
author, items.author_sec, items.author_offset,
committer, now, None,
@@ -360,8 +360,7 @@ def append_commit(src_loc, parent, src_repo, dest_repo, rewriter, excludes,
if not rewriter:
assert isinstance(src_loc, (bytes, Loc)), src_loc
oidx = src_loc if isinstance(src_loc, bytes) else hexlify(src_loc.hash)
- return transfer_commit(None, # unused
- oidx, parent, src_repo, dest_repo,
+ return transfer_commit(oidx, parent, src_repo, dest_repo,
ignore_missing)
# Friendlier checking was done during resolve_*
@@ -595,8 +594,7 @@ def handle_ff(item, src_repo, dest_repo):
dest_oidx = hexlify(item.dest.hash) if item.dest.hash else None
if not dest_oidx or dest_oidx in src_repo.rev_list(src_oidx):
# Can fast forward.
- get_random_item(item.spec.src, src_oidx, src_repo, dest_repo,
- item.spec.ignore_missing)
+ get_random_item(src_oidx, src_repo, dest_repo, item.spec.ignore_missing)
commit_items = parse_commit(get_cat_data(
src_repo.cat(src_oidx), b'commit'))
return GetResult(item.src.hash, unhexlify(commit_items.tree))
misuse('destination is not an ancestor of source for %s'
@@ -611,8 +609,7 @@ def resolve_append(spec, src_repo, dest_repo):
% (spec_msg(spec), src.type))
spec, dest = resolve_branch_dest(spec, src, src_repo, dest_repo)
if spec.rewriter:
- def vpm(path):
- return path_msg(b"/".join(x[0] for x in src_path))
+ def vpm(path): return path_msg(b"/".join(x[0] for x in path))
if not isinstance(src, Loc):
misuse(f'cannot currently rewrite git location {src}')
src_path = src.vfs_path
@@ -633,8 +630,7 @@ def handle_append(item, src_repo, dest_repo):
src_oidx = hexlify(item.src.hash)
if item.spec.rewriter:
misuse(f'rewrite cannot yet promote tree to commit for {spec_msg(item.spec)}')
- get_random_item(item.spec.src, src_oidx, src_repo, dest_repo,
- item.spec.ignore_missing)
+ get_random_item(src_oidx, src_repo, dest_repo, item.spec.ignore_missing)
parent = item.dest.hash
msg = commit_message(b'bup get', compat.get_argvb())
userline = b'%s <%s@%s>' % (userfullname(), username(), hostname())
@@ -724,8 +720,8 @@ def resolve_new_tag(spec, src_repo, dest_repo):
def handle_new_tag(item, src_repo, dest_repo):
assert item.spec.method == 'new-tag'
assert item.dest.path.startswith(b'/.tag/')
- get_random_item(item.spec.src, hexlify(item.src.hash),
- src_repo, dest_repo, item.spec.ignore_missing)
+ get_random_item(hexlify(item.src.hash), src_repo, dest_repo,
+ item.spec.ignore_missing)
return GetResult(item.src.hash)
@@ -756,18 +752,17 @@ def resolve_replace(spec, src_repo, dest_repo):
def handle_replace(item, src_repo, dest_repo):
assert(item.spec.method == 'replace')
if item.dest.path.startswith(b'/.tag/'):
- get_random_item(item.spec.src, hexlify(item.src.hash),
- src_repo, dest_repo, item.spec.ignore_missing)
+ get_random_item(hexlify(item.src.hash), src_repo, dest_repo,
+ item.spec.ignore_missing)
return GetResult(item.src.hash)
assert(item.dest.type == 'branch' or not item.dest.type)
src_oidx = hexlify(item.src.hash)
- get_random_item(item.spec.src, src_oidx, src_repo, dest_repo,
- item.spec.ignore_missing)
+ get_random_item(src_oidx, src_repo, dest_repo, item.spec.ignore_missing)
commit_items = parse_commit(get_cat_data(
src_repo.cat(src_oidx), b'commit'))
return GetResult(item.src.hash, unhexlify(commit_items.tree))
-def resolve_unnamed(spec, src_repo, dest_repo):
+def resolve_unnamed(spec, src_repo, dest_repo_):
assert not spec.rewriter, spec
if spec.dest:
misuse('destination name given for %s' % spec_msg(spec))
@@ -778,8 +773,8 @@ def resolve_unnamed(spec, src_repo, dest_repo):
def handle_unnamed(item, src_repo, dest_repo):
- get_random_item(item.spec.src, hexlify(item.src.hash),
- src_repo, dest_repo, item.spec.ignore_missing)
+ get_random_item(hexlify(item.src.hash), src_repo, dest_repo,
+ item.spec.ignore_missing)
return GetResult()
diff --git a/lib/bup/cmd/index.py b/lib/bup/cmd/index.py
index 813537a9..91c9c8c4 100644
--- a/lib/bup/cmd/index.py
+++ b/lib/bup/cmd/index.py
@@ -91,8 +91,7 @@ def update_index(top, excluded_paths, exclude_rxs, fsindex,
fake_hash = None
if fake_valid:
- def fake_hash(name):
- return (GIT_MODE_FILE, index.FAKE_SHA)
+ def fake_hash(name_): return (GIT_MODE_FILE, index.FAKE_SHA)
total = 0
bup_dir = os.path.abspath(defaultrepo())
diff --git a/lib/bup/cmd/save.py b/lib/bup/cmd/save.py
index f8d91207..07e76fe6 100644
--- a/lib/bup/cmd/save.py
+++ b/lib/bup/cmd/save.py
@@ -62,7 +62,7 @@ graft= a graft point *old_path*=*new_path* (can be used more than once)
after_nondir_metadata_stat = None
-def before_saving_regular_file(name):
+def before_saving_regular_file(name_):
return
@@ -436,7 +436,7 @@ def commit_tree(tree, parent, date, argv, repo):
userline = (b'%s <%s@%s>' % (userfullname(), username(), hostname()))
return repo.write_commit(tree, parent, userline, date, None,
userline, date, None,
- commit_message(b'bup save', get_argvb()))
+ commit_message(b'bup save', argv))
def main(argv):
@@ -487,7 +487,7 @@ def main(argv):
out.write(hexlify(tree))
out.write(b'\n')
if opt.commit or
opt.name:
- commit = commit_tree(tree, parent, opt.date, argv, repo)
+ commit = commit_tree(tree, parent, opt.date, get_argvb(), repo)
if opt.commit:
out.write(hexlify(commit))
out.write(b'\n')
diff --git a/lib/bup/cmd/split.py b/lib/bup/cmd/split.py
index 0370f4ed..3eeccc74 100644
--- a/lib/bup/cmd/split.py
+++ b/lib/bup/cmd/split.py
@@ -202,9 +202,8 @@ def main(argv):
class IterToFile:
def __init__(self, it):
self.it = iter(it)
- def read(self, size):
- v = next(
self.it, None)
- return v or b''
+ def read(self, size_):
+ return next(
self.it, b'')
def read_ids():
while 1:
line = stdin.readline()
diff --git a/lib/bup/cmd/web.py b/lib/bup/cmd/web.py
index c5bf625d..8b909db9 100644
--- a/lib/bup/cmd/web.py
+++ b/lib/bup/cmd/web.py
@@ -37,8 +37,7 @@ def http_date_from_utc_ns(utc_ns):
return time.strftime('%a, %d %b %Y %H:%M:%S', time.gmtime(utc_ns / 10**9))
-def normalize_bool(k, v):
- return 1 if v else 0
+def normalize_bool(k_, v): bool(v)
def from_req_bool(k, v):
@@ -335,7 +334,7 @@ class BupRequestHandler(tornado.web.RequestHandler):
io_loop = None
-def handle_sigterm(signum, frame):
+def handle_sigterm(signum, frame_):
global io_loop
debug1('\nbup-web: signal %d received\n' % signum)
log('Shutdown requested\n')
diff --git a/lib/bup/git.py b/lib/bup/git.py
index 39e7c2ba..44b7447d 100644
--- a/lib/bup/git.py
+++ b/lib/bup/git.py
@@ -767,7 +767,7 @@ def idxmerge(idxlist, final_progress=True):
def pfinal(count, total):
if final_progress:
progress('Reading indexes: %.2f%% (%d/%d), done.\n'
- % (100, total, total))
+ % (100, count, total))
return merge_iter(idxlist, 10024, pfunc, pfinal)
diff --git a/lib/bup/helpers.py b/lib/bup/helpers.py
index fecee88e..86343eeb 100644
--- a/lib/bup/helpers.py
+++ b/lib/bup/helpers.py
@@ -476,7 +476,7 @@ class BaseConn:
def drain_and_check_ok(self):
"""Remove all data for the current command from input stream."""
- def onempty(rl):
+ def onempty(rl_):
pass
return self._check_ok(onempty)
diff --git a/lib/bup/index.py b/lib/bup/index.py
index d197c4a8..c79c39e6 100644
--- a/lib/bup/index.py
+++ b/lib/bup/index.py
@@ -382,7 +382,7 @@ class ExistingEntry(Entry):
self.flags = newflags
self.repack()
- def unset_sha_missing(self, flag):
+ def unset_sha_missing(self):
if self.flags & IX_SHAMISSING:
self.flags &= ~IX_SHAMISSING
self.repack()
diff --git a/lib/bup/metadata.py b/lib/bup/metadata.py
index 9d4d0736..5252ac0f 100644
--- a/lib/bup/metadata.py
+++ b/lib/bup/metadata.py
@@ -237,7 +237,7 @@ class Metadata:
# LostMetadata when making changes to the records (particularly
# the common records).
- def _add_common(self, path, st):
+ def _add_common(self, st):
assert(st.st_uid >= 0)
assert(st.st_gid >= 0)
self.size = st.st_size
@@ -676,7 +676,9 @@ class Metadata:
raise EOFError('EOF while reading Linux attr metadata')
self.linux_attr = vint.unpack('V', data)[0]
- def _apply_linux_attr_rec(self, path, restore_numeric_ids=False):
+ def _apply_linux_attr_rec(self, path,
+ # pylint: disable-next=unused-argument
+ restore_numeric_ids=False):
if self.linux_attr:
check_linux_file_attr_api()
if not set_linux_file_attr:
@@ -702,7 +704,7 @@ class Metadata:
## Linux extended attributes (getfattr(1), setfattr(1))
- def _add_linux_xattr(self, path, st):
+ def _add_linux_xattr(self, path):
if not xattr: return
try:
self.linux_xattr = xattr.get_all(path, nofollow=True)
@@ -742,7 +744,9 @@ class Metadata:
result.append((key, value))
self.linux_xattr = result
- def _apply_linux_xattr_rec(self, path, restore_numeric_ids=False):
+ def _apply_linux_xattr_rec(self, path,
+ # pylint: disable-next=unused-argument
+ restore_numeric_ids=False):
if not xattr:
if self.linux_xattr:
note_error("error: can't restore xattrs (no support): %s\n"
@@ -1013,13 +1017,13 @@ def from_path(path, statinfo=None, archive_path=None,
st = statinfo or xstat.lstat(path)
if after_stat:
after_stat(path)
- result._add_common(path, st)
+ result._add_common(st)
if save_symlinks:
result._add_symlink_target(path, st)
result._add_hardlink_target(hardlink_target)
result._add_posix1e_acl(path, st)
result._add_linux_attr(path, st)
- result._add_linux_xattr(path, st)
+ result._add_linux_xattr(path)
if normalized:
# Only store sizes for regular files and symlinks for now.
if not (stat.S_ISREG(result.mode) or stat.S_ISLNK(result.mode)):
diff --git a/lib/bup/options.py b/lib/bup/options.py
index 73a07e66..7b3d096a 100644
--- a/lib/bup/options.py
+++ b/lib/bup/options.py
@@ -115,7 +115,7 @@ class OptDict:
return self[k]
-def _default_onabort(msg):
+def _default_onabort(msg_):
sys.exit(97)
diff --git a/lib/bup/protocol.py b/lib/bup/protocol.py
index eaba7100..ddb885f0 100644
--- a/lib/bup/protocol.py
+++ b/lib/bup/protocol.py
@@ -181,7 +181,7 @@ class Server:
pass
@_command
- def help(self, args):
+ def help(self, args_):
self.conn.write(b'Commands:\n %s\n' % b'\n '.join(sorted(self._commands)))
self.conn.ok()
@@ -212,7 +212,7 @@ class Server:
self.conn.ok()
@_command
- def list_indexes(self, junk):
+ def list_indexes(self, junk_):
assert self._deduplicate_writes is not None
self.init_session()
suffix = b'' if self._deduplicate_writes else b' load'
@@ -241,7 +241,7 @@ class Server:
raise Exception(msg % (expected, actual))
@_command
- def receive_objects_v2(self, junk):
+ def receive_objects_v2(self, junk_):
self.init_session()
if self.suspended:
self.suspended = False
@@ -334,7 +334,7 @@ class Server:
cat = join # apocryphal alias
@_command
- def cat_batch(self, dummy):
+ def cat_batch(self, dummy_):
self.init_session()
# For now, avoid potential deadlock by just reading them all
for ref in tuple(lines_until_sentinel(self.conn, b'\n', Exception)):
diff --git a/lib/bup/rewrite.py b/lib/bup/rewrite.py
index 2126694b..49456f38 100755
--- a/lib/bup/rewrite.py
+++ b/lib/bup/rewrite.py
@@ -74,7 +74,7 @@ def _prep_mapping_table(db, split_cfg):
' without rowid')
return table_id
-def _previous_conversion(dstrepo, item, vfs_dir, db, mapping):
+def _previous_conversion(dstrepo, item, db, mapping):
"""Return (replacement_item, converted_oid, git_mode) for the
given item if any, *and* if the dstrepo has the item.oid. If not,
converted_oid and mode will be None. The replacement_item will
@@ -251,7 +251,7 @@ def _vfs_walk_dir_recursively(srcrepo, dstrepo, path, excludes, db, mapping,
yield sub_path, None
else:
conv_item, oid, _ = \
- _previous_conversion(dstrepo, sub_item, True, db, mapping)
+ _previous_conversion(dstrepo, sub_item, db, mapping)
assert conv_item.oid == sub_item.oid
if conv_item is not sub_item:
sub_path = sub_path[:-1] + ((sub_path[-1][0], conv_item),)
@@ -352,8 +352,8 @@ def _maybe_exec_mode(git_mode, meta):
return GIT_MODE_EXEC
return git_mode
-def _rewrite_save_item(save_path, path, replacement_dir, srcrepo, dstrepo,
- split_cfg, stack, wdbc, mapping, excludes, repairs):
+def _rewrite_save_item(path, replacement_dir, srcrepo, dstrepo, split_cfg,
+ stack, wdbc, mapping, excludes, repairs):
"""Returns either None, or, if a directory was missing, the
directory path components.
@@ -364,7 +364,6 @@ def _rewrite_save_item(save_path, path, replacement_dir, srcrepo, dstrepo,
incomplete = path
path = incomplete.path
- # save_path is the full vfs save path e.g. branch/DATE.
fs_path = path[2:] # drop everything before the save
assert isinstance(fs_path[0][1], vfs.Commit), fs_path[0]
name, item = path[-1]
@@ -453,8 +452,7 @@ def _rewrite_save_item(save_path, path, replacement_dir, srcrepo, dstrepo,
extend_stack(dir_path[len(stack):])
- item, oid, git_mode = \
- _previous_conversion(dstrepo, item, is_dir, wdbc, mapping)
+ item, oid, git_mode = _previous_conversion(dstrepo, item, wdbc, mapping)
item_mode = vfs.item_mode(item)
assert S_ISREG(item_mode)
@@ -597,8 +595,7 @@ class Rewriter:
in _vfs_walk_dir_recursively(srcrepo, dstrepo, save_path,
excludes, dbc, self._mapping,
repairs):
- _rewrite_save_item(save_path, path, replacement_dir,
- srcrepo, dstrepo,
+ _rewrite_save_item(path, replacement_dir, srcrepo, dstrepo,
self._split_cfg, stack, dbc,
self._mapping, excludes, repairs)
diff --git a/lib/bup/vfs.py b/lib/bup/vfs.py
index f46fa3cb..5dbeade6 100644
--- a/lib/bup/vfs.py
+++ b/lib/bup/vfs.py
@@ -685,7 +685,7 @@ def _tree_items_except_dot(oid, entries, names=None, bupm=None, *, repair=False)
if meta_ents is None:
assert repair or not bupm, (meta_ents, repair, bupm)
- def read_nondir_meta(bupd, default_mode):
+ def read_nondir_meta(default_mode):
if meta_ents is not None:
meta = meta_ents.pop()
# empty for a number of reasons; see Repository Taxonomy in DESIGN
@@ -699,7 +699,7 @@ def _tree_items_except_dot(oid, entries, names=None, bupm=None, *, repair=False)
def tree_item(ent_oid, kind, gitmode):
if kind == BUP_CHUNKED:
assert S_ISDIR(gitmode), (ent_oid, kind, gitmode)
- meta = read_nondir_meta(bupm, _default_mode_for_gitinfo(gitmode, kind))
+ meta = read_nondir_meta(_default_mode_for_gitinfo(gitmode, kind))
return Chunky(oid=ent_oid, meta=meta)
if S_ISDIR(gitmode):
@@ -707,7 +707,7 @@ def _tree_items_except_dot(oid, entries, names=None, bupm=None, *, repair=False)
return Item(meta=_default_mode_for_gitinfo(gitmode, kind),
oid=ent_oid)
- meta = read_nondir_meta(bupm, _default_mode_for_gitinfo(gitmode, kind))
+ meta = read_nondir_meta(_default_mode_for_gitinfo(gitmode, kind))
return Item(oid=ent_oid, meta=meta)
assert isinstance(names, (set, frozenset)) or names is None
@@ -1353,7 +1353,7 @@ def join(repo, ref):
or a commit. The content of all blobs that can be seen from trees or
commits will be added to the list.
"""
- def _join(oidx, typ, size, it, path):
+ def _join(oidx, typ, size_, it, path):
if typ == b'blob':
yield from it
elif typ == b'tree':
diff --git a/test/int/test_bloom.py b/test/int/test_bloom.py
index 2bcf2286..68ece564 100644
--- a/test/int/test_bloom.py
+++ b/test/int/test_bloom.py
@@ -35,6 +35,7 @@ def test_bloom(tmpdir):
assert b.k == 5
+# pylint: disable-next=unused-argument
def test_large_bloom(tmpdir):
# Test large (~1GiB) filter. This may fail on s390 (31-bit
# architecture), and anywhere else where the address space is
--
2.47.3