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%
A utility that enables objects to automatically capture and store the variable name they're assigned to during instantiation.
config stores "config" as the object's name @testdatabase_connection stores "database_connection" as the object's name @testobj.setting, it captures "setting" as its name @testregistry['handler'], it captures "handler" as its name @test@generates
class NamedObject:
"""
A class that automatically captures the variable name it's assigned to.
Instances store their assigned variable name in a `name` attribute.
"""
def __init__(self):
"""Initialize a NamedObject and capture the assignment variable name."""
pass
@property
def name(self) -> str:
"""Return the captured variable name."""
passProvides variable name introspection capabilities.