]> arthur.barton.de Git - bup.git/commitdiff
pylint: check for trailing whitespace
authorJohannes Berg <johannes@sipsolutions.net>
Fri, 27 Aug 2021 22:08:38 +0000 (00:08 +0200)
committerRob Browning <rlb@defaultvalue.org>
Fri, 17 Sep 2021 16:20:20 +0000 (11:20 -0500)
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Reviewed-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
17 files changed:
.pylintrc
lib/bup/bloom.py
lib/bup/client.py
lib/bup/cmd/bloom.py
lib/bup/cmd/fsck.py
lib/bup/cmd/fuse.py
lib/bup/cmd/midx.py
lib/bup/cmd/restore.py
lib/bup/cmd/server.py
lib/bup/cmd/web.py
lib/bup/drecurse.py
lib/bup/hashsplit.py
lib/bup/helpers.py
lib/bup/index.py
lib/bup/main.py
lib/bup/midx.py
lib/bup/vfs.py

index 74e7c1f9976243ee54e6975736205f37772c855f..0b67f81dd5653503aa2c07cee4a327a1e395da14 100644 (file)
--- a/.pylintrc
+++ b/.pylintrc
@@ -2,4 +2,7 @@
 
 [MESSAGES CONTROL]
 disable=all
-enable=unused-import,unused-wildcard-import
+enable=
+  trailing-whitespace,
+  unused-import,
+  unused-wildcard-import
index f8ae3dd005927bcea2d6107a5d90b55b43f3d88f..cb9821416504ea0f198d19cbe70a8b6cfaac6cec 100644 (file)
@@ -148,7 +148,7 @@ class ShaBloom:
             return self._init_failed()
         ver = struct.unpack('!I', self.map[4:8])[0]
         if ver < BLOOM_VERSION:
-            log('Warning: ignoring old-style (v%d) bloom %r\n' 
+            log('Warning: ignoring old-style (v%d) bloom %r\n'
                 % (ver, filename))
             return self._init_failed()
         if ver > BLOOM_VERSION:
index 9372d609c4464196cad6777a70a3d2b162b551d0..6eeb7081c669d2636ce026f6a9623ec376817e21 100644 (file)
@@ -162,11 +162,11 @@ class Client:
     def check_busy(self):
         if self._busy:
             raise ClientError('already busy with command %r' % self._busy)
-        
+
     def ensure_busy(self):
         if not self._busy:
             raise ClientError('expected to be busy, but not busy?!')
-        
+
     def _not_busy(self):
         self._busy = None
 
index 27d26b148ec3b5232d4689f13c7c454cff539df8..1896f5e3341441aa9c0ad7f7f8dd9dfc41d13e8b 100755 (executable)
@@ -124,7 +124,7 @@ def do_bloom(path, outfilename, k, force):
     icount = 0
     for name in add:
         ix = git.open_idx(name)
-        qprogress('bloom: writing %.2f%% (%d/%d objects)\r' 
+        qprogress('bloom: writing %.2f%% (%d/%d objects)\r'
                   % (icount*100.0/add_count, icount, add_count))
         b.add_idx(ix)
         count += 1
index 0725f539b6bfce7efddb9bebfe49464f92db202c..10074c8e48f4ba4d5d51183fa8f07d7b13cbabdf 100755 (executable)
@@ -107,7 +107,7 @@ def quick_verify(base):
     if sum.digest() != wantsum:
         raise ValueError('expected %r, got %r' % (hexlify(wantsum),
                                                   sum.hexdigest()))
-        
+
 
 def git_verify(base):
     if opt.quick:
@@ -119,8 +119,8 @@ def git_verify(base):
         return 0
     else:
         return run([b'git', b'verify-pack', b'--', base])
-    
-    
+
+
 def do_pack(base, last, par2_exists, out):
     code = 0
     if par2_ok and par2_exists and (opt.repair or not opt.generate):
index 6307119704882ffed3905759c0b5a28836a75d59..b1be8ac00cd1007a8f94dbcfdde0927dfa10f818 100755 (executable)
@@ -43,7 +43,7 @@ class BupFs(fuse.Fuse):
         self.repo = repo
         self.verbose = verbose
         self.fake_metadata = fake_metadata
-    
+
     def getattr(self, path):
         path = argv_bytes(path)
         if self.verbose > 0:
index 0d42958350a9950adadd83bb047de742042dea60..ba13b4a030b61ba00a7c64bc578bef09212a05e3 100755 (executable)
@@ -55,7 +55,7 @@ def check_midx(name):
         sub = git.open_idx(os.path.join(os.path.dirname(name), subname))
         for ecount,e in enumerate(sub):
             if not (ecount % 1234):
-                qprogress('  %d/%d: %s %d/%d\r' 
+                qprogress('  %d/%d: %s %d/%d\r'
                           % (count, len(ix.idxnames),
                              git.shorten_hash(subname).decode('ascii'),
                              ecount, len(sub)))
@@ -87,7 +87,7 @@ def _do_midx(outdir, outfilename, infilenames, prefixstr,
         assert(outdir)
         sum = hexlify(Sha1(b'\0'.join(infilenames)).digest())
         outfilename = b'%s/midx-%s.midx' % (outdir, sum)
-    
+
     inp = []
     total = 0
     allfilenames = []
@@ -181,11 +181,11 @@ def do_midx_dir(path, outfilename, prout, auto=False, force=False,
             m = git.open_idx(mname)
             contents[mname] = [(b'%s/%s' % (path,i)) for i in m.idxnames]
             sizes[mname] = len(m)
-                    
+
         # sort the biggest+newest midxes first, so that we can eliminate
         # smaller (or older) redundant ones that come later in the list
         midxs.sort(key=lambda ix: (-sizes[ix], -xstat.stat(ix).st_mtime))
-        
+
         for mname in midxs:
             any = 0
             for iname in contents[mname]:
@@ -205,12 +205,12 @@ def do_midx_dir(path, outfilename, prout, auto=False, force=False,
         sizes[iname] = len(i)
 
     all = [(sizes[n],n) for n in (midxs + idxs)]
-    
+
     # FIXME: what are the optimal values?  Does this make sense?
     DESIRED_HWM = force and 1 or 5
     DESIRED_LWM = force and 1 or 2
     existed = dict((name,1) for sz,name in all)
-    debug1('midx: %d indexes; want no more than %d.\n' 
+    debug1('midx: %d indexes; want no more than %d.\n'
            % (len(all), DESIRED_HWM))
     if len(all) <= DESIRED_HWM:
         debug1('midx: nothing to do.\n')
index 825493ffa6d09be40bd3559760d0447d836fe4d6..aeb1c7ba2955feccde69057ffb40c178e7a15d92 100755 (executable)
@@ -75,7 +75,7 @@ def apply_metadata(meta, name, restore_numeric_ids, owner_map):
     m.uid = owner_map['uid'].get(m.uid, m.uid)
     m.gid = owner_map['gid'].get(m.gid, m.gid)
     m.apply_to_path(name, restore_numeric_ids = restore_numeric_ids)
-    
+
 def hardlink_compatible(prev_path, prev_item, new_item, top):
     prev_candidate = top + prev_path
     if not os.path.exists(prev_candidate):
@@ -101,7 +101,7 @@ def hardlink_if_possible(fullname, item, top, hardlinks):
 
     # FIXME: we can probably replace the target_vfs_path with the
     # relevant vfs item
-    
+
     # hardlinks tracks a list of (restore_path, vfs_path, meta)
     # triples for each path we've written for a given hardlink_target.
     # This allows us to handle the case where we restore a set of
@@ -148,7 +148,7 @@ def write_file_content_sparsely(repo, dest_path, vfs_file):
             os.ftruncate(outfd, pos)
         finally:
             os.close(outfd)
-            
+
 def restore(repo, parent_path, name, item, top, sparse, numeric_ids, owner_map,
             exclude_rxs, verbosity, hardlinks):
     global total_restored
@@ -225,7 +225,7 @@ def main(argv):
         opt.remote = argv_bytes(opt.remote)
     if opt.outdir:
         opt.outdir = argv_bytes(opt.outdir)
-    
+
     git.check_repo_or_die()
 
     if not extra:
index 7cb5a2a10107b797337ca5ee6f9ccdc1c39c4b11..824a9b2545cb1a88f602cf1301e05ead2edaff62 100755 (executable)
@@ -24,7 +24,7 @@ def do_help(conn, junk):
 def _set_mode():
     global dumb_server_mode
     dumb_server_mode = os.path.exists(git.repo(b'bup-dumb-server'))
-    debug1('bup server: serving in %s mode\n' 
+    debug1('bup server: serving in %s mode\n'
            % (dumb_server_mode and 'dumb' or 'smart'))
 
 
@@ -56,7 +56,7 @@ def set_dir(conn, arg):
     _init_session(arg)
     conn.ok()
 
-    
+
 def list_indexes(conn, junk):
     _init_session()
     suffix = b''
@@ -98,7 +98,7 @@ def receive_objects_v2(conn, junk):
         n = struct.unpack('!I', ns)[0]
         #debug2('expecting %d bytes\n' % n)
         if not n:
-            debug1('bup server: received %d object%s.\n' 
+            debug1('bup server: received %d object%s.\n'
                 % (w.count, w.count!=1 and "s" or ''))
             fullpath = w.close(run_midx=not dumb_server_mode)
             if fullpath:
@@ -111,7 +111,7 @@ def receive_objects_v2(conn, junk):
             suspended_w = w
             conn.ok()
             return
-            
+
         shar = conn.read(20)
         crcr = struct.unpack('!I', conn.read(4))[0]
         n -= 20 + 4
@@ -135,7 +135,7 @@ def receive_objects_v2(conn, junk):
         nw, crc = w._raw_write((buf,), sha=shar)
         _check(w, crcr, crc, 'object read: expected crc %d, got %d\n')
     # NOTREACHED
-    
+
 
 def _check(w, expected, actual, msg):
     if expected != actual:
index ccac6faaecc8da780bcfdb60ab0d1d7d4c6c5ef6..d83fb12ff73ee196ef2a9af3314a9edd5014f484 100755 (executable)
@@ -90,7 +90,7 @@ def _dir_contents(repo, resolution, show_hidden=False):
 
         return display_name, link + url_query, display_size
 
-    dir_item = resolution[-1][1]    
+    dir_item = resolution[-1][1]
     for name, item in vfs.contents(repo, dir_item):
         if not show_hidden:
             if (name not in (b'.', b'..')) and name.startswith(b'.'):
@@ -118,7 +118,7 @@ class BupRequestHandler(tornado.web.RequestHandler):
 
     def head(self, path):
         return self._process_request(path)
-    
+
     def _process_request(self, path):
         print('Handling request for %s' % path)
         sys.stdout.flush()
@@ -173,7 +173,7 @@ class BupRequestHandler(tornado.web.RequestHandler):
         ctype = self._guess_type(path)
         self.set_header("Last-Modified", http_date_from_utc_ns(meta.mtime))
         self.set_header("Content-Type", ctype)
-        
+
         self.set_header("Content-Length", str(meta.size))
         assert len(file_item.oid) == 20
         self.set_header("Etag", hexlify(file_item.oid))
index ba41a12758268da40509726926c818efa7208250..b948b39e7e713fde5f244a6f17bfb66cf0443b8a 100644 (file)
@@ -24,7 +24,7 @@ class OsFile:
     def __init__(self, path):
         self.fd = None
         self.fd = os.open(path, os.O_RDONLY|O_LARGEFILE|O_NOFOLLOW|os.O_NDELAY)
-        
+
     def __del__(self):
         if self.fd:
             fd = self.fd
index 16ccbb15f8152935567707defe84c9d3b26013aa..ff00e54b3cd46b4fda1b30827e03762c7ebce025 100644 (file)
@@ -37,12 +37,12 @@ class Buf:
             self.data = cat_bytes(self.data, self.start, remaining,
                                   s, 0, len(s))
             self.start = 0
-            
+
     def peek(self, count):
         if count <= 256:
             return self.data[self.start : self.start + count]
         return buffer(self.data, self.start, count)
-    
+
     def eat(self, count):
         self.start += count
 
index b0cff727d0b3e9453a6bf2e473a7356229fc06d6..e2f543f6cf1af29054df8ac9b18dd72da0db930c 100644 (file)
@@ -161,7 +161,7 @@ def progress(s):
 
 def qprogress(s):
     """Calls progress() only if we haven't printed progress in a while.
-    
+
     This avoids overloading the stderr buffer with excess junk.
     """
     global _last_prog
index a2abfa7a266bd84338b8b7365af61cd05a9e07f0..fde4a67d7f2ecba5710e53a4afce5e86d9387782 100644 (file)
@@ -127,7 +127,7 @@ class Level:
         (ofs,n) = (f.tell(), len(self.list))
         if self.list:
             count = len(self.list)
-            #log('popping %r with %d entries\n' 
+            #log('popping %r with %d entries\n'
             #    % (''.join(self.ename), count))
             for e in self.list:
                 e.write(f)
@@ -402,7 +402,7 @@ class ExistingEntry(Entry):
 
     def __iter__(self):
         return self.iter()
-            
+
 
 class Reader:
     def __init__(self, filename):
@@ -557,7 +557,7 @@ class Writer:
 
     def _add(self, ename, entry):
         if self.lastfile and self.lastfile <= ename:
-            raise Error('%r must come before %r' 
+            raise Error('%r must come before %r'
                              % (''.join(ename), ''.join(self.lastfile)))
         self.lastfile = ename
         self.level = _golevel(self.level, self.f, ename, entry,
@@ -634,7 +634,7 @@ def reduce_paths(paths):
     paths = []
     prev = None
     for (rp, p) in xpaths:
-        if prev and (prev == rp 
+        if prev and (prev == rp
                      or (prev.endswith(b'/') and rp.startswith(prev))):
             continue # already superceded by previous path
         paths.append((rp, p))
index 0234a1b68ede1f57ff1ed2cc71b924b663cf1b18..5b6cad1f9b21fdf760df2d9ca68485f017c1ad90 100755 (executable)
@@ -82,7 +82,7 @@ def usage(msg=""):
     for cmd,synopsis in sorted(common.items()):
         log('    %-10s %s\n' % (cmd, synopsis))
     log('\n')
-    
+
     log('Other available commands:\n')
     cmds = set()
     for c in sorted(os.listdir(cmdpath)):
@@ -98,7 +98,7 @@ def usage(msg=""):
 
     log(columnate(sorted(cmds), '    '))
     log('\n')
-    
+
     log("See 'bup help COMMAND' for more information on " +
         "a specific command.\n")
     if msg:
index a18981da8afd3cbb596f1736c27a1d155833840f..84e7969bb20e74ca80b2d731b6ceb60eac20da7b 100644 (file)
@@ -34,9 +34,9 @@ class PackMidx:
             return self._init_failed()
         ver = struct.unpack('!I', self.map[4:8])[0]
         if ver < MIDX_VERSION:
-            log('Warning: ignoring old-style (v%d) midx %r\n' 
+            log('Warning: ignoring old-style (v%d) midx %r\n'
                 % (ver, path_msg(filename)))
-            self.force_keep = False  # old stuff is boring  
+            self.force_keep = False  # old stuff is boring
             return self._init_failed()
         if ver > MIDX_VERSION:
             log('Warning: ignoring too-new (v%d) midx %r\n'
index 015209d7a5b13257f3bb514857a1dade0e9b8b48..fd016b27ed7ffae334caccb95ad976a226793da8 100644 (file)
@@ -205,7 +205,7 @@ class _FileReader(object):
         if not self._size:
             self._size = _normal_or_chunked_file_size(self._repo, self.oid)
         return self._size
-        
+
     def seek(self, ofs):
         if ofs < 0 or ofs > self._compute_size():
             raise IOError(EINVAL, 'Invalid seek offset: %d' % ofs)
@@ -264,7 +264,7 @@ def _decompose_path(path):
     if not parts:
         must_be_dir = True  # e.g. path was effectively '.' or '/', etc.
     return is_absolute, must_be_dir, parts
-    
+
 
 Item = namedtuple('Item', ('meta', 'oid'))
 Chunky = namedtuple('Chunky', ('meta', 'oid'))
@@ -480,7 +480,7 @@ def tree_data_and_bupm(repo, oid):
     """Return (tree_bytes, bupm_oid) where bupm_oid will be None if the
     tree has no metadata (i.e. older bup save, or non-bup tree).
 
-    """    
+    """
     assert len(oid) == 20
     it = repo.cat(hexlify(oid))
     _, item_t, size = next(it)
@@ -639,7 +639,7 @@ def ordered_tree_entries(tree_data, bupm=None):
         tree_ents = sorted(tree_ents, key=lambda x: x[0])
     for ent in tree_ents:
         yield ent
-    
+
 def tree_items(oid, tree_data, names=frozenset(), bupm=None):
 
     def tree_item(ent_oid, kind, gitmode):
@@ -718,7 +718,7 @@ def tree_items_with_meta(repo, oid, tree_data, names):
         yield item
 
 _save_name_rx = re.compile(br'^\d\d\d\d-\d\d-\d\d-\d{6}(-\d+)?$')
-        
+
 def _reverse_suffix_duplicates(strs):
     """Yields the elements of strs, with any runs of duplicate values
     suffixed with -N suffixes, where the zero padded integer N
@@ -1032,7 +1032,7 @@ def _resolve_path(repo, path, parent=None, want_meta=True, follow=True):
                 else:
                     future.extend(target_future)
                 hops += 1
-                
+
 def resolve(repo, path, parent=None, want_meta=True, follow=True):
     """Follow the path in the virtual filesystem and return a tuple
     representing the location, if any, denoted by the path.  Each