(value: ServedQuality | str | None)
| 41 | |
| 42 | |
| 43 | def quality_rank(value: ServedQuality | str | None) -> int: |
| 44 | if isinstance(value, ServedQuality): |
| 45 | return _QUALITY_RANK[value] |
| 46 | normalized = str(value or "").strip().lower() |
| 47 | for quality, rank in _QUALITY_RANK.items(): |
| 48 | if quality.value == normalized: |
| 49 | return rank |
| 50 | return _QUALITY_RANK[ServedQuality.ECONOMY] |
| 51 | |
| 52 | |
| 53 | def normalize_served_quality(value: ServedQuality | str | None) -> ServedQuality | None: |
no outgoing calls
no test coverage detected