Browse Source

Merge pull request #2852 from ThomasWaldmann/lgtm-fixes

lgtm fixes
TW 8 years ago
parent
commit
4fa8805407
4 changed files with 9 additions and 8 deletions
  1. 2 2
      setup.py
  2. 4 4
      src/borg/archive.py
  3. 1 1
      src/borg/constants.py
  4. 2 1
      src/borg/repository.py

+ 2 - 2
setup.py

@@ -368,12 +368,12 @@ class build_usage(Command):
                 # "+ 1" because we want a space between the cell contents and the delimiting "|" in the output
                 column_widths[i] = max(column_widths[i], len(cells[i]) + 1)
 
-        for columns, *cells in rows:
+        for columns, *original_cells in rows:
             write_row_separator()
             # If a cell contains newlines, then the row must be split up in individual rows
             # where each cell contains no newline.
             rowspanning_cells = []
-            original_cells = list(cells)
+            original_cells = list(original_cells)
             while any('\n' in cell for cell in original_cells):
                 cell_bloc = []
                 for i, cell in enumerate(original_cells):

+ 4 - 4
src/borg/archive.py

@@ -172,11 +172,11 @@ backup_io = BackupIO()
 def backup_io_iter(iterator):
     backup_io.op = 'read'
     while True:
-        try:
-            with backup_io:
+        with backup_io:
+            try:
                 item = next(iterator)
-        except StopIteration:
-            return
+            except StopIteration:
+                return
         yield item
 
 

+ 1 - 1
src/borg/constants.py

@@ -34,7 +34,7 @@ MAX_DATA_SIZE = 20971479
 # MAX_OBJECT_SIZE = <20 MiB (MAX_DATA_SIZE) + 41 bytes for a Repository PUT header, which consists of
 # a 1 byte tag ID, 4 byte CRC, 4 byte size and 32 bytes for the ID.
 MAX_OBJECT_SIZE = MAX_DATA_SIZE + 41  # see LoggedIO.put_header_fmt.size assertion in repository module
-assert MAX_OBJECT_SIZE == 20971520 == 20 * 1024 * 1024
+assert MAX_OBJECT_SIZE == 20 * 1024 * 1024
 
 # borg.remote read() buffer size
 BUFSIZE = 10 * 1024 * 1024

+ 2 - 1
src/borg/repository.py

@@ -642,7 +642,8 @@ class Repository:
             # get rid of the old, sparse, unused segments. free space.
             for segment in unused:
                 logger.debug('complete_xfer: deleting unused segment %d', segment)
-                assert self.segments.pop(segment) == 0, 'Corrupted segment reference count - corrupted index or hints'
+                count = self.segments.pop(segment)
+                assert count == 0, 'Corrupted segment reference count - corrupted index or hints'
                 self.io.delete_segment(segment)
                 del self.compact[segment]
             unused = []