or run

tessl search
Log in

Version

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

tessl/pypi-fastcore

tessl install tessl/pypi-fastcore@1.8.0

Python supercharged for fastai development

Agent Success

Agent success rate when using this tile

56%

Improvement

Agent success rate improvement when using this tile compared to baseline

1.37x

Baseline

Agent success rate without this tile

41%

task.mdevals/scenario-2/

Configuration Parser

Build a configuration file parser that reads various data formats and converts them to appropriate Python types with validation.

Capabilities

Parse string values to appropriate types

Your parser should handle conversion of string values from configuration files into appropriate Python types.

  • Converting the string "true" returns the boolean True @test
  • Converting the string "123" returns the integer 123 @test
  • Converting the string "45.67" returns the float 45.67 @test

Handle list conversions

The parser should convert various input formats into lists.

  • Converting the string "item1,item2,item3" returns a list ["item1", "item2", "item3"] @test
  • Converting a single value "item" returns a list ["item"] @test
  • Converting None with a default value ["default"] returns ["default"] @test

Validate and convert with fallbacks

The parser should provide safe conversion with default values when conversion fails or input is None.

  • Converting None to int with default 0 returns 0 @test
  • Converting invalid string "abc" to int with default -1 returns -1 @test

Implementation

@generates

API

def parse_value(value: str, target_type: str):
    """
    Parse a string value to the target type.

    Args:
        value: String value to parse
        target_type: Target type name ('bool', 'int', 'float', 'list')

    Returns:
        Parsed value in the target type

    Raises:
        ValueError: If conversion fails
    """
    pass

def safe_convert(value, converter, default=None):
    """
    Safely convert a value using a converter function with fallback.

    Args:
        value: Value to convert (can be None)
        converter: Function to use for conversion
        default: Default value if conversion fails or value is None

    Returns:
        Converted value or default
    """
    pass

def ensure_list(value, default=None):
    """
    Ensure value is a list, converting single values or using default.

    Args:
        value: Value to convert to list
        default: Default value if value is None

    Returns:
        List containing the value(s)
    """
    pass

Dependencies { .dependencies }

fastcore { .dependency }

Provides type conversion and validation utilities.

@satisfied-by