or run

tessl search
Log in

Version

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

tessl/pypi-varname

tessl install tessl/pypi-varname@0.15.0

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

task.mdevals/scenario-10/

Configuration Value Tracker

Build a system for creating self-documenting configuration values that automatically track both their assigned variable name and their value.

Problem Description

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.

Requirements

Configuration Entry Creation

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.

Value and Name Access

Configuration entries should provide:

  • Access to the underlying configuration value via a value attribute
  • Access to the captured variable name via a name attribute
  • A string representation showing both the name and value

Multiple Entry Support

The system should work correctly when creating multiple configuration entries, with each one capturing its own unique variable name.

Test Cases

  • Creating a configuration entry automatically captures the variable name it's assigned to @test
  • Configuration entries correctly store their assigned values @test
  • String representation shows both name and value in readable format @test
  • Multiple configuration entries each capture their own unique variable names @test

Implementation

@generates

API

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
        """
        pass

Dependencies { .dependencies }

varname { .dependency }

Provides metaprogramming capabilities for variable name introspection.

@satisfied-by