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

make_event_iterator() — anthropic-sdk-python Function Reference

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

Function python AnthropicClient SyncAPI calls 1 called by 10

Entity Profile

Dependency Diagram

graph TD
  fbe4a363_44d9_e077_1c73_3ec8f52d326c["make_event_iterator()"]
  2da79393_445f_321e_d12f_59a347c0de92["test_streaming.py"]
  fbe4a363_44d9_e077_1c73_3ec8f52d326c -->|defined in| 2da79393_445f_321e_d12f_59a347c0de92
  9ba7b77c_2041_f85b_c8a9_8d706334f102["test_basic()"]
  9ba7b77c_2041_f85b_c8a9_8d706334f102 -->|calls| fbe4a363_44d9_e077_1c73_3ec8f52d326c
  05d1245b_97b0_6c50_3ad7_415048b640c4["test_data_missing_event()"]
  05d1245b_97b0_6c50_3ad7_415048b640c4 -->|calls| fbe4a363_44d9_e077_1c73_3ec8f52d326c
  6fdaa624_7911_f3bd_508e_3a3a3b41d90f["test_event_missing_data()"]
  6fdaa624_7911_f3bd_508e_3a3a3b41d90f -->|calls| fbe4a363_44d9_e077_1c73_3ec8f52d326c
  89b4081c_caa5_bc15_c2c1_6f0a549ae87c["test_multiple_events()"]
  89b4081c_caa5_bc15_c2c1_6f0a549ae87c -->|calls| fbe4a363_44d9_e077_1c73_3ec8f52d326c
  730feed6_74f5_12c5_ea44_2402762b38a6["test_multiple_events_with_data()"]
  730feed6_74f5_12c5_ea44_2402762b38a6 -->|calls| fbe4a363_44d9_e077_1c73_3ec8f52d326c
  bc18ac09_bd91_a5fa_1a48_cb8bf74ade81["test_multiple_data_lines_with_empty_line()"]
  bc18ac09_bd91_a5fa_1a48_cb8bf74ade81 -->|calls| fbe4a363_44d9_e077_1c73_3ec8f52d326c
  a0534227_cea6_0f9f_1ca1_46d2d50033c4["test_data_json_escaped_double_new_line()"]
  a0534227_cea6_0f9f_1ca1_46d2d50033c4 -->|calls| fbe4a363_44d9_e077_1c73_3ec8f52d326c
  1cbd585a_e4e8_0cc8_6e82_2204a19ee08f["test_multiple_data_lines()"]
  1cbd585a_e4e8_0cc8_6e82_2204a19ee08f -->|calls| fbe4a363_44d9_e077_1c73_3ec8f52d326c
  522ee4f1_a04e_9a01_9a92_868b8b2dbf4a["test_special_new_line_character()"]
  522ee4f1_a04e_9a01_9a92_868b8b2dbf4a -->|calls| fbe4a363_44d9_e077_1c73_3ec8f52d326c
  5fc0eae3_c56c_97e8_5f66_4b76e427a078["test_multi_byte_character_multiple_chunks()"]
  5fc0eae3_c56c_97e8_5f66_4b76e427a078 -->|calls| fbe4a363_44d9_e077_1c73_3ec8f52d326c
  0566c624_707d_17d9_793f_853a0655fbf5["to_aiter()"]
  fbe4a363_44d9_e077_1c73_3ec8f52d326c -->|calls| 0566c624_707d_17d9_793f_853a0655fbf5
  style fbe4a363_44d9_e077_1c73_3ec8f52d326c fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

tests/test_streaming.py lines 244–256

def make_event_iterator(
    content: Iterator[bytes],
    *,
    sync: bool,
    client: Anthropic,
    async_client: AsyncAnthropic,
) -> Iterator[ServerSentEvent] | AsyncIterator[ServerSentEvent]:
    if sync:
        return Stream(cast_to=object, client=client, response=httpx.Response(200, content=content))._iter_events()

    return AsyncStream(
        cast_to=object, client=async_client, response=httpx.Response(200, content=to_aiter(content))
    )._iter_events()

Subdomains

Calls

Frequently Asked Questions

What does make_event_iterator() do?
make_event_iterator() is a function in the anthropic-sdk-python codebase, defined in tests/test_streaming.py.
Where is make_event_iterator() defined?
make_event_iterator() is defined in tests/test_streaming.py at line 244.
What does make_event_iterator() call?
make_event_iterator() calls 1 function(s): to_aiter.
What calls make_event_iterator()?
make_event_iterator() is called by 10 function(s): test_basic, test_data_json_escaped_double_new_line, test_data_missing_event, test_event_missing_data, test_multi_byte_character_multiple_chunks, test_multiple_data_lines, test_multiple_data_lines_with_empty_line, test_multiple_events, and 2 more.

Analyze Your Own Codebase

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

Try Supermodel Free