MCPcopy Create free account
hub / github.com/bloomberg/pystack / is_gzip

Function is_gzip

src/pystack/process.py:143–155  ·  view source on GitHub ↗

Checks if the given file is a Gzip file based on the header. Args: filename (pathlib.Path): The path to the file to be checked. Returns: bool: True if the file starts with the Gzip header, False otherwise.

(filename: pathlib.Path)

Source from the content-addressed store, hash-verified

141
142
143def is_gzip(filename: pathlib.Path) -> bool:
144 """
145 Checks if the given file is a Gzip file based on the header.
146
147 Args:
148 filename (pathlib.Path): The path to the file to be checked.
149
150 Returns:
151 bool: True if the file starts with the Gzip header, False otherwise.
152 """
153 gzip_header = b"\x1f\x8b"
154 with open(filename, "rb") as thefile:
155 return thefile.read(2) == gzip_header
156
157
158def decompress_gzip(

Callers 1

process_coreFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected