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%
A utility for processing and sorting user activity records from async data streams.
The system should process async streams of user activity records and sort them by their timestamp in ascending order.
The system should support custom sorting logic using key functions that can perform async operations.
The system should properly handle edge cases with empty data.
@generates
from typing import AsyncIterable, List, Dict, Any, Optional, Callable
async def sort_activities(
activities: AsyncIterable[Dict[str, Any]],
key: Optional[Callable[[Dict[str, Any]], Any]] = None,
reverse: bool = False
) -> List[Dict[str, Any]]:
"""
Sort user activity records from an async stream.
Args:
activities: An async iterable of activity dictionaries
key: Optional function to extract comparison key from each activity
reverse: If True, sort in descending order
Returns:
A sorted list of activity dictionaries
"""
passProvides async-compatible standard library functions for working with async iterables.
@satisfied-by