Buckets:
AnonymousSpottedToad/candidate_bucket / codebase /python /CIRISAI_CIRISAgent /ciris_engine /utils /serialization.py
| """Serialization utilities for CIRIS.""" | |
| from datetime import datetime | |
| from typing import Any, Optional | |
| def serialize_timestamp(timestamp: datetime, _info: Any = None) -> Optional[str]: | |
| """ | |
| Standard timestamp serialization for Pydantic models. | |
| Converts datetime to ISO format string for JSON serialization. | |
| Args: | |
| timestamp: The datetime to serialize | |
| _info: Pydantic serialization info (unused but required for field_serializer) | |
| Returns: | |
| ISO format string or None if timestamp is None | |
| """ | |
| return timestamp.isoformat() if timestamp else None | |
| def serialize_datetime(dt: datetime) -> Optional[str]: | |
| """ | |
| Serialize datetime to ISO format. | |
| Simple version without the _info parameter for non-Pydantic use. | |
| Args: | |
| dt: The datetime to serialize | |
| Returns: | |
| ISO format string or None if dt is None | |
| """ | |
| return dt.isoformat() if dt else None | |
Xet Storage Details
- Size:
- 932 Bytes
- Xet hash:
- 794773e315977cde708a594d6b39ed0b91710b1a812e3479fad1f2e3e510237e
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.