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

_AsyncStreamMeta Class — anthropic-sdk-python Architecture

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

Entity Profile

Dependency Diagram

graph TD
  06e103f1_c04f_3dc3_84b3_de39ef09adee["_AsyncStreamMeta"]
  4f4cec09_94d5_eeb6_5c17_29d2af98f435["AsyncMessageStream"]
  06e103f1_c04f_3dc3_84b3_de39ef09adee -->|extends| 4f4cec09_94d5_eeb6_5c17_29d2af98f435
  8d141d22_ab1c_b4a1_744c_99e460d07454["_streaming.py"]
  06e103f1_c04f_3dc3_84b3_de39ef09adee -->|defined in| 8d141d22_ab1c_b4a1_744c_99e460d07454
  d0bbd79f_0a9b_d34b_5ed4_5cb42fe7d4b4["__instancecheck__()"]
  06e103f1_c04f_3dc3_84b3_de39ef09adee -->|method| d0bbd79f_0a9b_d34b_5ed4_5cb42fe7d4b4

Relationship Graph

Source Code

src/anthropic/_streaming.py lines 140–158

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

        from .lib.streaming import AsyncMessageStream

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

        return False

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free