.pylintrc | 5 ++++
lib/bup/cmd/midx.py | 18 +++++++-------
lib/bup/cmd/tag.py | 4 ++--
lib/bup/git.py | 4 ++--
test/int/test_hashsplit.py | 6 ++---
test/lib/wvpytest.py | 49 ++++++++++++++++++++------------------
6 files changed, 47 insertions(+), 39 deletions(-)
diff --git a/.pylintrc b/.pylintrc
index 3aa4c095..788e53de 100644
--- a/.pylintrc
+++ b/.pylintrc
@@ -1,6 +1,10 @@
# -*-conf-*-
[GENERAL OPTIONS]
+[BASIC]
+class-rgx=([_a-z]+)|(_?([A-Z]+[a-z]*)+) # LocalRepo mmap finalized...
+const-rgx=([_a-z]+)|([_A-Z]+) # snake-case uppper or lower
+
[VARIABLES]
ignored-argument-names=.*_$
@@ -34,6 +38,7 @@ enable=
function-redefined,
import-outside-toplevel,
inconsistent-return-statements,
+ invalid-name,
logging-not-lazy,
no-else-continue,
no-else-raise,
diff --git a/lib/bup/cmd/midx.py b/lib/bup/cmd/midx.py
index fb93e490..a97c4605 100644
--- a/lib/bup/cmd/midx.py
+++ b/lib/bup/cmd/midx.py
@@ -244,23 +244,23 @@ def do_midx_dir(path, outfilename, prout, auto=False, force=False,
all = [(sizes[n],n) for n in (midxs + idxs)]
# FIXME: what are the optimal values? Does this make sense?
- DESIRED_HWM = 1 if force else 5
- DESIRED_LWM = 1 if force else 2
+ desired_hwm = 1 if force else 5
+ desired_lwm = 1 if force else 2
existed = dict((name,1) for sz,name in all)
debug1('midx: %d indexes; want no more than %d.\n'
- % (len(all), DESIRED_HWM))
- if len(all) <= DESIRED_HWM:
+ % (len(all), desired_hwm))
+ if len(all) <= desired_hwm:
debug1('midx: nothing to do.\n')
- while len(all) > DESIRED_HWM:
+ while len(all) > desired_hwm:
all.sort()
- part1 = [name for sz,name in all[:len(all)-DESIRED_LWM+1]]
- part2 = all[len(all)-DESIRED_LWM+1:]
+ part1 = [name for sz,name in all[:len(all)-desired_lwm+1]]
+ part2 = all[len(all)-desired_lwm+1:]
all = list(do_midx_group(path, outfilename, part1,
auto=auto, force=force, max_files=max_files)) \
+ part2
- if len(all) > DESIRED_HWM:
+ if len(all) > desired_hwm:
debug1('\nStill too many indexes (%d > %d). Merging again.\n'
- % (len(all), DESIRED_HWM))
+ % (len(all), desired_hwm))
if print_names:
for sz,name in all:
diff --git a/lib/bup/cmd/tag.py b/lib/bup/cmd/tag.py
index 60160ccc..3870ada5 100644
--- a/lib/bup/cmd/tag.py
+++ b/lib/bup/cmd/tag.py
@@ -72,8 +72,8 @@ def main(argv):
log("bup: error: commit %s not found.\n" % commit.decode('ascii'))
return EXIT_FAILURE
- with git.PackIdxList(git.repo(b'objects/pack')) as pL:
- if not pL.exists(hash):
+ with git.PackIdxList(git.repo(b'objects/pack')) as pl:
+ if not pl.exists(hash):
log("bup: error: commit %s not found.\n" % commit.decode('ascii'))
return EXIT_FAILURE
diff --git a/lib/bup/git.py b/lib/bup/git.py
index 44b7447d..ee50822a 100644
--- a/lib/bup/git.py
+++ b/lib/bup/git.py
@@ -1158,8 +1158,8 @@ def rev_parse(committish, repo_dir=None):
except TypeError:
return None
- with PackIdxList(repo(b'objects/pack', repo_dir=repo_dir)) as pL:
- if pL.exists(hash):
+ with PackIdxList(repo(b'objects/pack', repo_dir=repo_dir)) as pl:
+ if pl.exists(hash):
return hash
return None
diff --git a/test/int/test_hashsplit.py b/test/int/test_hashsplit.py
index ba54b08d..12d0a1a3 100644
--- a/test/int/test_hashsplit.py
+++ b/test/int/test_hashsplit.py
@@ -208,7 +208,7 @@ def test_hashsplitter_object():
hs = HashSplitter([BytesIO(data)], bits=BUP_BLOBBITS, fanbits=1)
for blob, lvl in hs:
yield len(blob), 13 + lvl
- def _splitbufRHS(data):
+ def _splitbuf_rhs(data):
offs = None
fed = 0
data = data[:]
@@ -229,10 +229,10 @@ def test_hashsplitter_object():
yield fed, 13
data = b''.join([b'%d\n' % x for x in range(10000)])
WVPASSEQ(list(_splitbuf(data)),
- list(x for x in _splitbufRHS(data)))
+ list(x for x in _splitbuf_rhs(data)))
data = b''.join([b'%.10x\n' % x for x in range(10000)])
WVPASSEQ(list(_splitbuf(data)),
- list(_splitbufRHS(data)))
+ list(_splitbuf_rhs(data)))
def test_hashsplitter_short_read():
class DataObj:
diff --git a/test/lib/wvpytest.py b/test/lib/wvpytest.py
index 3e5f7755..b383eac1 100644
--- a/test/lib/wvpytest.py
+++ b/test/lib/wvpytest.py
@@ -2,55 +2,58 @@
import pytest
-def WVPASS(cond = True, fail_value=None):
+def wvpass(cond = True, fail_value=None):
if fail_value:
assert cond, fail_value
else:
assert cond
-def WVFAIL(cond = True):
+def wvfail(cond = True):
assert not cond
-def WVPASSEQ(a, b, fail_value=None):
+def wvpasseq(a, b, fail_value=None):
if fail_value:
assert a == b, fail_value
else:
assert a == b
-def WVPASSNE(a, b):
+def wvpassne(a, b):
assert a != b
-def WVPASSLT(a, b):
+def wvpasslt(a, b):
assert a < b
-def WVPASSLE(a, b):
+def wvpassle(a, b):
assert a <= b
-def WVPASSGT(a, b):
+def wvpassgt(a, b):
assert a > b
-def WVPASSGE(a, b):
+def wvpassge(a, b):
assert a >= b
-def WVEXCEPT(etype, func, *args, **kwargs):
+def wvexcept(etype, func, *args, **kwargs):
with pytest.raises(etype):
func(*args, **kwargs)
-def WVCHECK(cond, msg):
+def wvcheck(cond, msg):
assert cond, msg
-def WVMSG(msg):
+def wvmsg(msg):
print(msg)
-wvpass = WVPASS
-wvfail = WVFAIL
-wvpasseq = WVPASSEQ
-wvpassne = WVPASSNE
-wvpaslt = WVPASSLT
-wvpassle = WVPASSLE
-wvpassgt = WVPASSGT
-wvpassge = WVPASSGE
-wvexcept = WVEXCEPT
-wvcheck = WVCHECK
-wvmsg = WVMSG
-wvstart = WVMSG
+wvstart = wvmsg
+
+
+WVPASS = wvpass
+WVFAIL = wvfail
+WVPASSEQ = wvpasseq
+WVPASSNE = wvpassne
+WVPASSLT = wvpasslt
+WVPASSLE = wvpassle
+WVPASSGT = wvpassgt
+WVPASSGE = wvpassge
+WVEXCEPT = wvexcept
+WVCHECK = wvcheck
+WVMSG = wvmsg
+WVSTART = wvmsg
--
2.47.3