AsyncIteratorExecutor
Base classes¶
| Name | Children | Inherits |
|---|---|---|
| Generic typing Abstract base class for generic types. |
⋔ Inheritance diagram¶
graph TD
2128754744["async_executor.AsyncIteratorExecutor"]
3481597255["typing.Generic"]
2751680898["builtins.object"]
3481597255 --> 2128754744
2751680898 --> 3481597255
🛈 DocStrings¶
Wrapper that provides both async call and sync() methods for async gens.
Source code in src/anyenv/calling/async_executor.py
403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 | |
observer_mode
property
writable
¶
Sequential or parallel observer execution.
__call__
async
¶
Return the async iterator with observer emission.
Source code in src/anyenv/calling/async_executor.py
__get__
¶
__get__(instance: Any, owner: type | None = None) -> AsyncIteratorExecutor[P, T]
Descriptor protocol for method binding.
Source code in src/anyenv/calling/async_executor.py
__getattr__
¶
__getitem__
¶
__getitem__(event_types: type[E] | UnionType) -> EventFilteredConnection[E]
Get filtered connection for specific event type(s).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
event_types
|
type[E] | UnionType
|
Single type or union of types to filter for |
required |
Returns:
| Type | Description |
|---|---|
EventFilteredConnection[E]
|
EventFilteredConnection that only triggers for matching event types |
Example
my_iterator[MyEvent].connect(handler) my_iterator[MyEvent | AnotherEvent].connect(handler)
Source code in src/anyenv/calling/async_executor.py
clear_observers
¶
connect
¶
Add observer that will be called with each yielded item.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
handler
|
Callable[[T], Any]
|
The callback function to connect |
required |
event_filter
|
Callable[[T], bool] | None
|
Optional filter function to selectively handle events |
None
|
Source code in src/anyenv/calling/async_executor.py
disconnect
¶
Remove observer.
Source code in src/anyenv/calling/async_executor.py
submit
¶
Fire-and-forget execution that collects all values, returns Task.
sync
¶
sync(*args: P.args, **kwargs: P.kwargs) -> LazyAsyncIterator[T]
Synchronous version that returns a truly lazy iterator.
The generator runs in a thread with its own event loop, at most a few items
ahead of the consumer. close() (or dropping the iterator) stops it.
Source code in src/anyenv/calling/async_executor.py
task
¶
Create a Task that collects all values into a list.
Source code in src/anyenv/calling/async_executor.py
timeout
async
¶
Collect all values with timeout.