tessl install tessl/pypi-frozendict@2.4.0A simple immutable dictionary implementation with hashing support and performance optimizations
Agent Success
Agent success rate when using this tile
85%
Improvement
Agent success rate improvement when using this tile compared to baseline
1.31x
Baseline
Agent success rate without this tile
65%
Build a configuration file reader that loads and queries configuration data using an immutable dictionary structure.
Create a ConfigReader class that:
The configuration reader should ensure that once loaded, the configuration data cannot be modified.
The ConfigReader should accept a dictionary during initialization and store it in an immutable format.
Provide a method to get configuration values by key. If a key doesn't exist, return a default value (None if not specified).
Provide a method to return all configuration keys in the order they were added.
Provide a method that checks whether all keys from a given list exist in the configuration. Return True only if all keys are present.
{"app.name": "MyApp", "app.version": "1.0"} and getting "app.name" returns "MyApp" @test{"debug": True} and listing all keys returns a sequence containing "debug" @test{"key1": "val1", "key2": "val2"} and validating that keys ["key1", "key2"] exist returns True @test{"key1": "val1"} and validating that keys ["key1", "key2"] exist returns False @test@generates
class ConfigReader:
"""A configuration reader that stores configuration in an immutable format."""
def __init__(self, config: dict):
"""Initialize with a configuration dictionary."""
pass
def get(self, key: str, default=None):
"""Retrieve a configuration value by key, returning default if not found."""
pass
def keys(self):
"""Return all configuration keys in order."""
pass
def has_keys(self, keys: list) -> bool:
"""Check if all specified keys exist in the configuration."""
passProvides immutable dictionary support for storing configuration data.