MCPcopy Create free account
hub / github.com/TheSmallHanCat/flow2api / _normalize_aspect_ratio

Function _normalize_aspect_ratio

src/core/model_resolver.py:444–467  ·  view source on GitHub ↗
(value: Any)

Source from the content-addressed store, hash-verified

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)

Callers 2

_apply_image_configFunction · 0.85

Calls 1

_normalize_strFunction · 0.85

Tested by

no test coverage detected