tessl install tessl/pypi-us@3.2.0A package for easily working with US and state metadata
Agent Success
Agent success rate when using this tile
88%
Improvement
Agent success rate improvement when using this tile compared to baseline
1.24x
Baseline
Agent success rate without this tile
71%
Build a utility that validates and normalizes US state names entered by users.
Create a Python module that accepts user-provided state names and validates them against official US state names. The module should handle various input formats and return normalized state information.
The module should provide a validate_state_name function that:
None if the input is not a valid US state nameThe returned dictionary should include:
name: The official full state nameabbreviation: The two-letter postal abbreviationis_valid: Boolean indicating the state was found (always True when a dict is returned){"name": "Maryland", "abbreviation": "MD", "is_valid": True} @test{"name": "California", "abbreviation": "CA", "is_valid": True} @test{"name": "Texas", "abbreviation": "TX", "is_valid": True} @testNone @testNone @test@generates
def validate_state_name(name: str) -> dict | None:
"""
Validates a US state name and returns normalized state information.
Args:
name: A string representing a potential US state name
Returns:
A dictionary with keys 'name', 'abbreviation', and 'is_valid' if valid,
None if the input is not a valid state name
"""
passProvides US state metadata and lookup functionality.
@satisfied-by