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 data aggregator that processes async streams of sensor readings and computes summary statistics.
You need to implement a function that processes async streams of numeric sensor readings and returns aggregated statistics. The function should efficiently handle async iterables and compute the sum, maximum, and minimum values from the stream.
Implement aggregate_sensor_data(readings) that:
"sum", "max", and "min""sum" key contains the total sum of all readings"max" key contains the largest reading value"min" key contains the smallest reading value{"sum": 0, "max": None, "min": None}{"sum": 60, "max": 30, "min": 10} @test{"sum": 18.9, "max": 8.1, "min": 2.3} (with floating point tolerance) @test{"sum": -35, "max": -5, "min": -20} @test{"sum": 0, "max": None, "min": None} @test{"sum": 42, "max": 42, "min": 42} @test@generates
async def aggregate_sensor_data(readings):
"""
Aggregate sensor readings from an async iterable.
Args:
readings: An async iterable of numeric values
Returns:
dict: A dictionary with keys "sum", "max", and "min"
"""
passProvides async-compatible versions of standard library functions for working with async iterables.
@satisfied-by
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