(value: Any)
| 442 | return None |
| 443 | |
| 444 | def _normalize_aspect_ratio(value: Any) -> Optional[str]: |
| 445 | raw = _normalize_str(value) |
| 446 | if not raw: |
| 447 | return None |
| 448 | |
| 449 | token = ( |
| 450 | raw.replace(":", ":") |
| 451 | .replace("/", ":") |
| 452 | .replace("x", ":") |
| 453 | .replace("X", ":") |
| 454 | .replace(" ", "") |
| 455 | .strip() |
| 456 | ) |
| 457 | |
| 458 | mapped = ASPECT_RATIO_MAP.get(token) |
| 459 | if mapped: |
| 460 | return mapped |
| 461 | mapped = ASPECT_RATIO_MAP.get(token.lower()) |
| 462 | if mapped: |
| 463 | return mapped |
| 464 | mapped = ASPECT_RATIO_MAP.get(token.upper()) |
| 465 | if mapped: |
| 466 | return mapped |
| 467 | return token |
| 468 | |
| 469 | def _normalize_image_size(value: Any) -> Optional[str]: |
| 470 | raw = _normalize_str(value) |
no test coverage detected