tessl install tessl/pypi-asyncstdlib@3.13.0The missing async toolbox - re-implements functions and classes of the Python standard library to make them compatible with async callables, iterables and context managers
Agent Success
Agent success rate when using this tile
84%
Improvement
Agent success rate improvement when using this tile compared to baseline
3.36x
Baseline
Agent success rate without this tile
25%
Build a service that processes async data streams by filtering elements based on corresponding boolean conditions.
Your service should handle filtering of async data streams where each data element has a corresponding boolean selector that determines whether to include it in the output.
Implement a function filter_by_selectors(data_stream, selector_stream) that:
[1, 2, 3, 4, 5] and selectors [True, False, True, False, True], the output should be [1, 3, 5] @test['a', 'b', 'c'] and selectors [False, False, False], the output should be an empty list @test['x', 'y', 'z'] and selectors [True, True, True], the output should be ['x', 'y', 'z'] @test@generates
async def filter_by_selectors(data_stream, selector_stream):
"""
Filter elements from data_stream based on corresponding selectors.
Args:
data_stream: An async iterable of data elements
selector_stream: An async iterable of boolean selectors
Returns:
An async iterable yielding only elements where selector is truthy
"""
passProvides async-compatible standard library functions for working with async iterables.