or run

tessl search
Log in

Version

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

tessl/pypi-yacs

tessl install tessl/pypi-yacs@0.1.0

A 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%

task.mdevals/scenario-6/

Plugin Configuration Manager

Build a configuration management system for a plugin-based application where different sections of the configuration have different levels of strictness regarding dynamic key addition.

Requirements

Your system should support three types of configuration sections:

  1. Core settings: Strict validation - no new keys allowed after initialization
  2. Plugin settings: Flexible configuration - arbitrary new keys can be added at runtime
  3. User preferences: Initially strict but can be made flexible on demand

Implement the following functionality:

  • Create a configuration object with three sections: CORE, PLUGINS, and USER_PREFS
  • CORE section must contain predefined keys: APP_NAME (string) and VERSION (string)
  • PLUGINS section should allow arbitrary plugin configurations to be added dynamically
  • USER_PREFS section should start with a predefined THEME (string) key but be upgradeable to accept dynamic keys
  • Provide a function to load plugin configurations from a list of key-value pairs
  • Provide a function to check if a configuration section accepts new keys
  • Provide a function to enable dynamic key addition for the user preferences section

Test Cases

  • Loading a valid plugin configuration with arbitrary keys succeeds @test
  • Attempting to add an undefined key to the CORE section raises an error @test
  • Checking if PLUGINS section allows new keys returns True @test
  • Enabling dynamic keys for USER_PREFS allows adding new keys @test

@generates

API

def create_config():
    """
    Creates and returns a configuration object with three sections:
    - CORE: Contains APP_NAME and VERSION, no new keys allowed
    - PLUGINS: Empty initially, allows arbitrary new keys
    - USER_PREFS: Contains THEME, initially strict but can be made flexible

    Returns:
        Configuration object with the three sections
    """
    pass

def load_plugin_config(config, plugin_opts):
    """
    Loads plugin configuration from a list of key-value pairs.

    Args:
        config: The configuration object
        plugin_opts: List in format [key1, value1, key2, value2, ...]
                    Keys should be prefixed with "PLUGINS." (e.g., "PLUGINS.my_plugin.enabled")

    Returns:
        None (modifies config in place)
    """
    pass

def allows_new_keys(config, section_name):
    """
    Checks if a configuration section accepts new keys.

    Args:
        config: The configuration object
        section_name: Name of the section (e.g., "CORE", "PLUGINS", "USER_PREFS")

    Returns:
        bool: True if section allows new keys, False otherwise
    """
    pass

def enable_dynamic_user_prefs(config):
    """
    Enables dynamic key addition for the USER_PREFS section.

    Args:
        config: The configuration object

    Returns:
        None (modifies config in place)
    """
    pass

Dependencies { .dependencies }

yacs { .dependency }

Configuration management library for handling hierarchical configurations.

@satisfied-by