The missing async toolbox - re-implements functions and classes of the Python standard library to make them compatible with async callables, iterables and context managers
84
Quality
Pending
Does it follow best practices?
Impact
84%
3.36xAverage score across 10 eval scenarios
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.
Install with Tessl CLI
npx tessl i tessl/pypi-asyncstdlibevals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
scenario-10