Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions unzip_http.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ def extract(self, member, path=None, pwd=None):

outpath = path/member
os.makedirs(outpath.parent, exist_ok=True)
with self.open(member) as fpin:
with self._open(member) as fpin:
with open(path/member, mode='wb') as fpout:
while True:
r = fpin.read(65536)
Expand All @@ -239,7 +239,7 @@ def matching_files(self, *globs):
if any(fnmatch.fnmatch(f.filename, g) for g in globs):
yield f

def open(self, fn):
def _open(self, fn):
if isinstance(fn, str):
f = list(self.matching_files(fn))
if not f:
Expand All @@ -260,8 +260,8 @@ def open(self, fn):
else:
error(f'unknown compression method {method}')

def open_text(self, fn):
return io.TextIOWrapper(self.open(fn))
def open(self, fn):
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The ZipFile.open() API should return a binary stream. So let's keep this as it was and fix VisiData instead.

return io.TextIOWrapper(self._open(fn))


class RemoteZipStream(io.RawIOBase):
Expand Down