Home / Function/ __decode__() — anthropic-sdk-python Function Reference

__decode__() — anthropic-sdk-python Function Reference

Architecture documentation for the __decode__() function in jsonl.py from the anthropic-sdk-python codebase.

Entity Profile

Dependency Diagram

graph TD
  5afca67b_7450_8f7a_3f11_b8ad0392063b["__decode__()"]
  db3528f4_d56c_fc6e_955a_06508f166b4e["JSONLDecoder"]
  5afca67b_7450_8f7a_3f11_b8ad0392063b -->|defined in| db3528f4_d56c_fc6e_955a_06508f166b4e
  style 5afca67b_7450_8f7a_3f11_b8ad0392063b fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

src/anthropic/_decoders/jsonl.py lines 43–60

    def __decode__(self) -> Iterator[_T]:
        buf = b""
        for chunk in self._raw_iterator:
            for line in chunk.splitlines(keepends=True):
                buf += line
                if buf.endswith((b"\r", b"\n", b"\r\n")):
                    yield construct_type_unchecked(
                        value=json.loads(buf),
                        type_=self._line_type,
                    )
                    buf = b""

        # flush
        if buf:
            yield construct_type_unchecked(
                value=json.loads(buf),
                type_=self._line_type,
            )

Subdomains

Frequently Asked Questions

What does __decode__() do?
__decode__() is a function in the anthropic-sdk-python codebase, defined in src/anthropic/_decoders/jsonl.py.
Where is __decode__() defined?
__decode__() is defined in src/anthropic/_decoders/jsonl.py at line 43.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free