规范化趋势窗口参数,非法值回退到默认值。
(value: Any)
| 49 | |
| 50 | |
| 51 | def normalize_trend_window(value: Any) -> str: |
| 52 | """规范化趋势窗口参数,非法值回退到默认值。""" |
| 53 | normalized = str(value or "").strip().lower() |
| 54 | if normalized in {"24h", "7d", "30d"}: |
| 55 | return normalized |
| 56 | if normalized == "1d": |
| 57 | return "24h" |
| 58 | return DEFAULT_TREND_WINDOW |
| 59 | |
| 60 | |
| 61 | def format_uptime(total_seconds: int) -> str: |
no outgoing calls
no test coverage detected