CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/pypi-asyncstdlib

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

3.36x

Quality

Pending

Does it follow best practices?

Impact

84%

3.36x

Average score across 10 eval scenarios

Overview
Eval results
Files

task.mdevals/scenario-9/

Async Data Validator

A library for validating streams of data from async sources with boolean checks.

Capabilities

Validate all items pass checks

Implement validation that checks if all items in an async stream satisfy given criteria.

  • When checking async iterable [1, 2, 3, 4], validate_all_positive returns True @test
  • When checking async iterable [1, -2, 3], validate_all_positive returns False @test
  • When checking empty async iterable, validate_all_positive returns True @test

Validate any item passes checks

Implement validation that checks if any item in an async stream satisfies given criteria.

  • When checking async iterable [1, 2, 3] with validator that accepts even numbers, validate_any_valid returns True @test
  • When checking async iterable [1, 3, 5] with validator that accepts even numbers, validate_any_valid returns False @test
  • When checking empty async iterable with any validator, validate_any_valid returns False @test

Validate with async predicates

Support validation using async predicate functions for complex checks.

  • When checking async iterable ["apple", "banana"] with async predicate that checks string length > 3, validate_all_with_predicate returns True @test
  • When checking async iterable ["hi", "hello"] with async predicate that checks string length > 3, validate_all_with_predicate returns False @test

Implementation

@generates

API

async def validate_all_positive(numbers) -> bool:
    """
    Check if all numbers in an async iterable are positive.

    Args:
        numbers: An async iterable of numbers

    Returns:
        True if all numbers are positive (> 0), False otherwise
    """
    pass

async def validate_any_valid(items, validator) -> bool:
    """
    Check if any item in an async iterable passes a validation function.

    Args:
        items: An async iterable of items to validate
        validator: A function (sync or async) that returns True for valid items

    Returns:
        True if at least one item is valid, False otherwise
    """
    pass

async def validate_all_with_predicate(items, predicate) -> bool:
    """
    Check if all items in an async iterable satisfy an async predicate.

    Args:
        items: An async iterable of items to check
        predicate: An async function that returns True/False for each item

    Returns:
        True if all items satisfy the predicate, False otherwise
    """
    pass

Dependencies { .dependencies }

asyncstdlib { .dependency }

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

@satisfied-by

Install with Tessl CLI

npx tessl i tessl/pypi-asyncstdlib

tile.json