visidata icon indicating copy to clipboard operation
visidata copied to clipboard

Investigate progress counters in FileProgress

Open anjakefala opened this issue 2 years ago • 0 comments

https://github.com/saulpw/visidata/issues/1159 is a bug caused by the commit https://github.com/saulpw/visidata/commit/d40361aa2d1649e49f0cfd623687114e4a231ec6. Consitent data integrity is the most important priority in VisiData, so it was decided to comment out the following lines:

Binary files a/sample_data/y77d-th95.json.gz and b/sample_data/y77d-th95.json.gz differ
diff --git a/visidata/path.py b/visidata/path.py
index 0b0c3ade..481a1fb6 100644
--- a/visidata/path.py
+++ b/visidata/path.py
@@ -46,11 +46,6 @@ class FileProgress:
             gerund = 'nothing'
 
         # track Progress on original fp
         self.fp_orig_read = self.fp.read
         self.fp_orig_close = self.fp.close
-        self.fp.read = self.read
-        self.fp.close = self.close
-
         if self.prog:
             self.prog.__enter__()
 
@@ -61,7 +56,7 @@ class FileProgress:
         return self.fp_orig_close(*args, **kwargs)
 

This fixes the problem, but loses the potential benefit of the monkey patch Progress, potentially losing Progress for loading .gz, and other zips.

This issue is to investigate the fixing of Progress counters for compressed formats, while making sure to not break saving to those formats.

anjakefala avatar Nov 06 '21 04:11 anjakefala