A package for easily working with US and state metadata
Overall
score
88%
Build a utility that validates and categorizes US geographic entities to distinguish between states and territories.
@generates
def is_territory(identifier: str) -> bool:
"""
Check if the given identifier (name or abbreviation) represents a US territory.
Args:
identifier: State/territory name or postal abbreviation (case-insensitive)
Returns:
True if the identifier represents a territory, False otherwise
Raises:
ValueError: If the identifier is not a valid US state or territory
"""
pass
def list_all_territories() -> list[str]:
"""
Return a list of all US territory names in alphabetical order.
Returns:
List of territory names sorted alphabetically
"""
pass
def count_by_type(identifiers: list[str]) -> dict[str, int]:
"""
Count how many states and territories are in the given list.
Args:
identifiers: List of state/territory names or abbreviations
Returns:
Dictionary with keys "states" and "territories" containing counts
Raises:
ValueError: If any identifier is not a valid US state or territory
"""
passProvides US state and territory metadata including territory identification.
@satisfied-by
Install with Tessl CLI
npx tessl i tessl/pypi-usdocs
evals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
scenario-10