def _use_gzip(self): i = 0 with gzip.open(self.filename) as gz_file: with io.BufferedReader(gz_file) as f: for line in f: i += 1 return i