Home / Class/ _SyncStreamMeta Class — anthropic-sdk-python Architecture

_SyncStreamMeta Class — anthropic-sdk-python Architecture

Architecture documentation for the _SyncStreamMeta class in _streaming.py from the anthropic-sdk-python codebase.

Entity Profile

Dependency Diagram

graph TD
  99d9f68f_5bd4_95f7_2936_862b6c910c99["_SyncStreamMeta"]
  ab992fa2_4b68_6313_c0c2_e2fbf8c9eb22["MessageStream"]
  99d9f68f_5bd4_95f7_2936_862b6c910c99 -->|extends| ab992fa2_4b68_6313_c0c2_e2fbf8c9eb22
  ec152243_3430_2b13_3ec8_94bec6c1615a["_streaming.py"]
  99d9f68f_5bd4_95f7_2936_862b6c910c99 -->|defined in| ec152243_3430_2b13_3ec8_94bec6c1615a
  64eed46a_9b37_00cc_3adf_bae3ad849a27["__instancecheck__()"]
  99d9f68f_5bd4_95f7_2936_862b6c910c99 -->|method| 64eed46a_9b37_00cc_3adf_bae3ad849a27

Relationship Graph

Source Code

src/anthropic/_streaming.py lines 23–41

class _SyncStreamMeta(abc.ABCMeta):
    @override
    def __instancecheck__(self, instance: Any) -> bool:
        # we override the `isinstance()` check for `Stream`
        # as a previous version of the `MessageStream` class
        # inherited from `Stream` & without this workaround,
        # changing it to not inherit would be a breaking change.

        from .lib.streaming import MessageStream

        if isinstance(instance, MessageStream):
            warnings.warn(
                "Using `isinstance()` to check if a `MessageStream` object is an instance of `Stream` is deprecated & will be removed in the next major version",
                DeprecationWarning,
                stacklevel=2,
            )
            return True

        return False

Extends

Frequently Asked Questions

What is the _SyncStreamMeta class?
_SyncStreamMeta is a class in the anthropic-sdk-python codebase, defined in src/anthropic/_streaming.py.
Where is _SyncStreamMeta defined?
_SyncStreamMeta is defined in src/anthropic/_streaming.py at line 23.
What does _SyncStreamMeta extend?
_SyncStreamMeta extends MessageStream.

Analyze Your Own Codebase

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

Try Supermodel Free