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

Class TextDecoder

httpx/_decoders.py:306–318  ·  view source on GitHub ↗

Handles incrementally decoding bytes into text

Source from the content-addressed store, hash-verified

304
305
306class TextDecoder:
307 """
308 Handles incrementally decoding bytes into text
309 """
310
311 def __init__(self, encoding: str = "utf-8") -> None:
312 self.decoder = codecs.getincrementaldecoder(encoding)(errors="replace")
313
314 def decode(self, data: bytes) -> str:
315 return self.decoder.decode(data)
316
317 def flush(self) -> str:
318 return self.decoder.decode(b"", True)
319
320
321class LineDecoder:

Callers 3

textMethod · 0.85
iter_textMethod · 0.85
aiter_textMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected