Spaces:
Running
Running
Rename utils/helpers.txt to utils/helpers.py
Browse files- utils/helpers.py +16 -0
- utils/helpers.txt +0 -0
utils/helpers.py
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from __future__ import annotations
|
| 2 |
+
|
| 3 |
+
from datetime import datetime, timezone
|
| 4 |
+
|
| 5 |
+
|
| 6 |
+
def utc_now_iso() -> str:
|
| 7 |
+
return datetime.now(timezone.utc).isoformat()
|
| 8 |
+
|
| 9 |
+
|
| 10 |
+
def safe_float(value, default: float = 0.0) -> float:
|
| 11 |
+
try:
|
| 12 |
+
if value is None:
|
| 13 |
+
return default
|
| 14 |
+
return float(value)
|
| 15 |
+
except (TypeError, ValueError):
|
| 16 |
+
return default
|
utils/helpers.txt
DELETED
|
File without changes
|