Validation utilities for pyetm curve and export types.
This module provides validation functionsthat raise clear ValueError exceptions
when invalid curve types, carrier types, or export names are provided.
Functions
validate_carrier_type
validate_carrier_type(carrier_type)
Validate that carrier_type is a valid carrier type.
Source code in src/pyetm/validators.py
| def validate_carrier_type(carrier_type: str) -> str:
"""Validate that carrier_type is a valid carrier type."""
return cast(
str,
_validate_literal_type(carrier_type, CarrierType, "carrier type", singular=True),
)
|
validate_export_names
validate_export_names(export_names)
Validate and normalize export names.
Source code in src/pyetm/validators.py
| def validate_export_names(export_names: str | list[str]) -> list[str]:
"""Validate and normalize export names."""
return cast(
list[str], _validate_literal_type(export_names, AnnualExportType, "export names")
)
|
validate_hourly_curve_names
validate_hourly_curve_names(curve_names)
Validate and normalize hourly curve names.
Source code in src/pyetm/validators.py
| def validate_hourly_curve_names(curve_names: str | list[str]) -> list[str]:
"""Validate and normalize hourly curve names."""
return cast(
list[str], _validate_literal_type(curve_names, HourlyCurveType, "curve names")
)
|