MCPcopy Index your code
hub / github.com/dpkp/kafka-python / gzip_encode

Function gzip_encode

kafka/codec.py:77–91  ·  view source on GitHub ↗
(payload, compresslevel=None)

Source from the content-addressed store, hash-verified

75
76
77def gzip_encode(payload, compresslevel=None):
78 if not compresslevel:
79 compresslevel = 9
80
81 buf = io.BytesIO()
82
83 # Gzip context manager introduced in python 2.7
84 # so old-fashioned way until we decide to not support 2.6
85 gzipper = gzip.GzipFile(fileobj=buf, mode="w", compresslevel=compresslevel)
86 try:
87 gzipper.write(payload)
88 finally:
89 gzipper.close()
90
91 return buf.getvalue()
92
93
94def gzip_decode(payload):

Callers 3

test_gzipFunction · 0.90
_maybe_compressMethod · 0.90
_maybe_compressMethod · 0.90

Calls 2

writeMethod · 0.45
closeMethod · 0.45

Tested by 1

test_gzipFunction · 0.72

Used in the wild real call sites across dependent graphs

searching dependent graphs…