or run

tessl search
Log in

Version

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
pypipkg:pypi/asyncstdlib@3.13.x
tile.json

tessl/pypi-asyncstdlib

tessl install tessl/pypi-asyncstdlib@3.13.0

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

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%

task.mdevals/scenario-6/

Async Data Filter Service

Build a service that processes async data streams by filtering elements based on corresponding boolean conditions.

Requirements

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.

Core Functionality

Implement a function filter_by_selectors(data_stream, selector_stream) that:

  • Takes two async iterables as input: a data stream and a selector stream
  • Returns an async iterable containing only the data elements where the corresponding selector is truthy
  • Processes both streams in parallel
  • Stops when either stream is exhausted

Test Cases

  • When given data [1, 2, 3, 4, 5] and selectors [True, False, True, False, True], the output should be [1, 3, 5] @test
  • When given data ['a', 'b', 'c'] and selectors [False, False, False], the output should be an empty list @test
  • When given data ['x', 'y', 'z'] and selectors [True, True, True], the output should be ['x', 'y', 'z'] @test

Implementation

@generates

API

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
    """
    pass

Dependencies { .dependencies }

asyncstdlib { .dependency }

Provides async-compatible standard library functions for working with async iterables.