Validate output format name. Args: format_name: Output format to validate. Returns: Validated format name. Raises: ValueError: If format is not supported.
(format_name: str)
| 127 | |
| 128 | |
| 129 | def validate_output_format(format_name: str) -> str: |
| 130 | """Validate output format name. |
| 131 | |
| 132 | Args: |
| 133 | format_name: Output format to validate. |
| 134 | |
| 135 | Returns: |
| 136 | Validated format name. |
| 137 | |
| 138 | Raises: |
| 139 | ValueError: If format is not supported. |
| 140 | """ |
| 141 | valid_formats = ["dict", "json", "html", "csv"] |
| 142 | |
| 143 | if not isinstance(format_name, str): |
| 144 | raise ValueError("Output format must be a string") |
| 145 | |
| 146 | format_name = format_name.lower().strip() |
| 147 | |
| 148 | if format_name not in valid_formats: |
| 149 | raise ValueError(f"Unsupported output format. Valid formats: {valid_formats}") |
| 150 | |
| 151 | return format_name |
| 152 | |
| 153 | |
| 154 | def validate_batch_size(batch_size: int, max_batch_size: int = 100) -> int: |
no outgoing calls