MCPcopy
hub / github.com/encode/httpx / decode

Method decode

httpx/_decoders.py:67–76  ·  view source on GitHub ↗
(self, data: bytes)

Source from the content-addressed store, hash-verified

65 self.decompressor = zlib.decompressobj()
66
67 def decode(self, data: bytes) -> bytes:
68 was_first_attempt = self.first_attempt
69 self.first_attempt = False
70 try:
71 return self.decompressor.decompress(data)
72 except zlib.error as exc:
73 if was_first_attempt:
74 self.decompressor = zlib.decompressobj(-zlib.MAX_WBITS)
75 return self.decode(data)
76 raise DecodingError(str(exc)) from exc
77
78 def flush(self) -> bytes:
79 try:

Callers

nothing calls this directly

Calls 1

DecodingErrorClass · 0.85

Tested by

no test coverage detected