tessl install tessl/pypi-yacs@0.1.0A lightweight library for defining and managing system configurations for scientific experimentation.
Agent Success
Agent success rate when using this tile
97%
Improvement
Agent success rate improvement when using this tile compared to baseline
1.05x
Baseline
Agent success rate without this tile
92%
Build a simple configuration manager for a machine learning training system that supports flexible access patterns and nested configuration structures.
Create a module that manages training configurations with the following capabilities:
The system should support creating hierarchical configurations with nested structures. Configurations should be accessible using both attribute-style notation (e.g., config.TRAIN.BATCH_SIZE) and dictionary-style notation (e.g., config['TRAIN']['BATCH_SIZE']).
The configuration system should enforce type safety by only allowing specific data types: strings, integers, floats, booleans, tuples, lists, and None values. Any attempt to store unsupported types should be prevented.
Given an empty configuration, when system settings are added with NUM_GPUS=4 and NUM_WORKERS=8, then these values should be retrievable using both attribute-style access (config.SYSTEM.NUM_GPUS) and dict-style access (config['SYSTEM']['NUM_WORKERS']) @test
Given a configuration with nested structure (TRAIN.OPTIMIZER.LEARNING_RATE=0.001 and TRAIN.OPTIMIZER.MOMENTUM=0.9), when accessing via mixed access patterns (config.TRAIN['OPTIMIZER'].LEARNING_RATE), then all values should be correctly retrievable @test
Given a configuration, when attempting to store a value of type 'set' or 'complex', then an error should be raised indicating invalid type @test
@generates
class ConfigNode:
"""A configuration container that supports both attribute and dictionary access patterns."""
def __init__(self, init_dict=None):
"""
Initialize a configuration node.
Args:
init_dict: Optional dictionary to initialize the configuration
"""
pass
def __getattr__(self, name):
"""Support attribute-style access (e.g., config.KEY)."""
pass
def __setattr__(self, name, value):
"""Support attribute-style assignment with type validation."""
pass
def __getitem__(self, key):
"""Support dictionary-style access (e.g., config['KEY'])."""
pass
def __setitem__(self, key, value):
"""Support dictionary-style assignment with type validation."""
passProvides configuration management support for building the ConfigNode class.
@satisfied-by