def _print_bag_records(self, fn): with open(fn) as f: f.seek(0, os.SEEK_END) size = f.tell() f.seek(0) version_line = f.readline().rstrip() print(version_line) while f.tell() < size: header = bag._read_header(f) op = bag._read_uint8_field(header, 'op') data = bag._read_record_data(f) print(bag._OP_CODES.get(op, op))