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

Class MultiDecoder

httpx/_decoders.py:203–225  ·  view source on GitHub ↗

Handle the case where multiple encodings have been applied.

Source from the content-addressed store, hash-verified

201
202
203class MultiDecoder(ContentDecoder):
204 """
205 Handle the case where multiple encodings have been applied.
206 """
207
208 def __init__(self, children: typing.Sequence[ContentDecoder]) -> None:
209 """
210 'children' should be a sequence of decoders in the order in which
211 each was applied.
212 """
213 # Note that we reverse the order for decoding.
214 self.children = list(reversed(children))
215
216 def decode(self, data: bytes) -> bytes:
217 for child in self.children:
218 data = child.decode(data)
219 return data
220
221 def flush(self) -> bytes:
222 data = b""
223 for child in self.children:
224 data = child.decode(data) + child.flush()
225 return data
226
227
228class ByteChunker:

Callers 1

_get_content_decoderMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected