Prechádzať zdrojové kódy

just call print() once in the odd print_() function

this will help when we want to refactor output functions

this function should definitely be replaced by a __repr__() or
__str__() however
Antoine Beaupré 9 rokov pred
rodič
commit
c996fd8366
1 zmenil súbory, kde vykonal 8 pridanie a 7 odobranie
  1. 8 7
      borg/helpers.py

+ 8 - 7
borg/helpers.py

@@ -143,13 +143,14 @@ class Statistics:
 
     def print_(self, label, cache):
         total_size, total_csize, unique_size, unique_csize, total_unique_chunks, total_chunks = cache.chunks.summarize()
-        print()
-        print('                       Original size      Compressed size    Deduplicated size')
-        print('%-15s %20s %20s %20s' % (label, format_file_size(self.osize), format_file_size(self.csize), format_file_size(self.usize)))
-        print('All archives:   %20s %20s %20s' % (format_file_size(total_size), format_file_size(total_csize), format_file_size(unique_csize)))
-        print()
-        print('                       Unique chunks         Total chunks')
-        print('Chunk index:    %20d %20d' % (total_unique_chunks, total_chunks))
+        buf = "\n"
+        buf += '                       Original size      Compressed size    Deduplicated size'
+        buf += '%-15s %20s %20s %20s' % (label, format_file_size(self.osize), format_file_size(self.csize), format_file_size(self.usize))
+        buf += 'All archives:   %20s %20s %20s' % (format_file_size(total_size), format_file_size(total_csize), format_file_size(unique_csize))
+        buf += "\n"
+        buf += '                       Unique chunks         Total chunks'
+        buf += 'Chunk index:    %20d %20d' % (total_unique_chunks, total_chunks)
+        print(buf)
 
     def show_progress(self, item=None, final=False):
         if not final: