We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent c92f28c commit f9588b1Copy full SHA for f9588b1
src/xopen/__init__.py
@@ -518,16 +518,14 @@ def _open_zst(
518
519
if zstandard is None:
520
raise ImportError("zstandard module (python-zstandard) not available")
521
- if compresslevel is not None and "w" in mode:
+ if compresslevel is not None and "r" not in mode:
522
cctx = zstandard.ZstdCompressor(level=compresslevel)
523
else:
524
cctx = None
525
f = zstandard.open(filename, mode, cctx=cctx) # type: ignore
526
if mode == "rb":
527
return io.BufferedReader(f)
528
- elif mode == "wb":
529
- return io.BufferedWriter(f)
530
- return f
+ return io.BufferedWriter(f) # mode "ab" and "wb"
531
532
533
def _open_gz(
0 commit comments