File size: 335 Bytes
1ce499f
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
import json, uuid
def safe_float(v,d=0.0):
    try: return d if v in (None,"") else float(v)
    except Exception: return d
def safe_int(v,d=0):
    try: return d if v in (None,"") else int(v)
    except Exception: return d
def dumps(x): return json.dumps(x, default=str)
def new_id(prefix): return f"{prefix}_{uuid.uuid4().hex[:16]}"