MCPcopy Index your code
hub / github.com/python/cpython / gzip_encode

Function gzip_encode

Lib/xmlrpc/client.py:1015–1025  ·  view source on GitHub ↗

data -> gzip encoded data Encode data using the gzip content encoding as described in RFC 1952

(data)

Source from the content-addressed store, hash-verified

1013# @return the encoded data
1014
1015def gzip_encode(data):
1016 """data -> gzip encoded data
1017
1018 Encode data using the gzip content encoding as described in RFC 1952
1019 """
1020 if not gzip:
1021 raise NotImplementedError
1022 f = BytesIO()
1023 with gzip.GzipFile(mode="wb", fileobj=f, compresslevel=1) as gzf:
1024 gzf.write(data)
1025 return f.getvalue()
1026
1027##
1028# Decode a string using the gzip content encoding such as specified by the

Callers 2

do_POSTMethod · 0.90
send_contentMethod · 0.85

Calls 3

getvalueMethod · 0.95
BytesIOClass · 0.90
writeMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…