Skip to content

Commit

Permalink
Remove deprecated function
Browse files Browse the repository at this point in the history
  • Loading branch information
rhpvorderman committed Jan 22, 2024
1 parent 7fd5027 commit f219a34
Showing 1 changed file with 0 additions and 24 deletions.
24 changes: 0 additions & 24 deletions src/xopen/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,30 +157,6 @@ def _set_pipe_size_to_max(fd: int) -> None:
pass


def _can_read_concatenated_gz(program: str) -> bool:
"""
Check if a concatenated gzip file can be read properly. Not all deflate
programs handle this properly.
"""
fd, temp_path = tempfile.mkstemp(suffix=".gz", prefix="xopen.")
try:
# Create a concatenated gzip file. gzip.compress recreates the contents
# of a gzip file including header and trailer.
with open(temp_path, "wb") as temp_file:
temp_file.write(gzip.compress(b"AB") + gzip.compress(b"CD"))
try:
result = subprocess.run(
[program, "-c", "-d", temp_path], check=True, stderr=PIPE, stdout=PIPE
)
return result.stdout == b"ABCD"
except subprocess.CalledProcessError:
# Program can't read zip
return False
finally:
os.close(fd)
os.remove(temp_path)


class _PipedCompressionProgram(io.IOBase):
"""
Read and write compressed files by running an external process and piping into it.
Expand Down

0 comments on commit f219a34

Please sign in to comment.