Method: gzip.compress
Calls: 22, Exceptions: 0, Paths: 1Back
Path 1: 22 calls (1.0)
bytes (22)
9 (13) 1 (5) 6 (4)
None (14) 123456789 (8)
bytes (22)
1def compress(data, compresslevel=_COMPRESS_LEVEL_BEST, *, mtime=None):
2 """Compress data in one shot and return the compressed string.
3 Optional argument is the compression level, in range of 0-9.
4 """
5 buf = io.BytesIO()
6 with GzipFile(fileobj=buf, mode='wb', compresslevel=compresslevel, mtime=mtime) as f:
7 f.write(data)
8 return buf.getvalue()