MCPcopy Create free account
hub / github.com/OpenRaiser/PaperFlow / _safe_iso_datetime

Function _safe_iso_datetime

skills/profile-updater/scripts/update_profile.py:100–109  ·  view source on GitHub ↗
(value: Any, fallback: Optional[datetime] = None)

Source from the content-addressed store, hash-verified

98
99
100def _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
112def _round_mapping(values: Dict[str, float], digits: int = 4) -> Dict[str, float]:

Callers 4

_paper_timestampFunction · 0.85
_days_sinceFunction · 0.85

Calls 1

nowMethod · 0.80

Tested by

no test coverage detected