(value: Any, fallback: Optional[datetime] = None)
| 98 | |
| 99 | |
| 100 | def _safe_iso_datetime(value: Any, fallback: Optional[datetime] = None) -> datetime: |
| 101 | if isinstance(value, datetime): |
| 102 | return value |
| 103 | if isinstance(value, str) and value.strip(): |
| 104 | cleaned = value.strip().replace("Z", "+00:00") |
| 105 | try: |
| 106 | return datetime.fromisoformat(cleaned) |
| 107 | except ValueError: |
| 108 | pass |
| 109 | return fallback or datetime.now() |
| 110 | |
| 111 | |
| 112 | def _round_mapping(values: Dict[str, float], digits: int = 4) -> Dict[str, float]: |
no test coverage detected