tessl install tessl/pypi-varname@0.15.0Dark magics about variable names in python
Agent Success
Agent success rate when using this tile
90%
Improvement
Agent success rate improvement when using this tile compared to baseline
1.41x
Baseline
Agent success rate without this tile
64%
Build a system for creating self-documenting configuration values that automatically track both their assigned variable name and their value.
You need to implement a configuration entry system that captures configuration values along with their variable names. When a configuration entry is created and assigned to a variable, it should automatically remember the variable name it was assigned to, making it easy to trace and debug configuration settings.
Create a class ConfigEntry that wraps configuration values while automatically capturing the variable name they're assigned to. Each entry should store both the configuration value and the name it was assigned to.
Configuration entries should provide:
value attributename attributeThe system should work correctly when creating multiple configuration entries, with each one capturing its own unique variable name.
@generates
class ConfigEntry:
"""
A configuration entry that bundles a value with its variable name.
Attributes:
name: The variable name this entry was assigned to
value: The configuration value stored in this entry
"""
def __init__(self, value):
"""
Initialize a configuration entry with a value.
The variable name is automatically captured.
Args:
value: The configuration value to store
"""
pass
def __str__(self):
"""
Return a string representation showing the name and value.
Returns:
A string representation of the entry
"""
passProvides metaprogramming capabilities for variable name introspection.
@satisfied-by