Spaces:
Sleeping
Sleeping
Vikram Vasudevan commited on
Commit ·
b7228fc
1
Parent(s): a05ab27
insights issue fix
Browse files
src/god_sim/analytics/history.py
CHANGED
|
@@ -13,9 +13,9 @@ class SimulationEncoder(json.JSONEncoder):
|
|
| 13 |
return int(obj)
|
| 14 |
if isinstance(obj, (np.floating, np.float64, np.float32, np.float16)):
|
| 15 |
return float(obj)
|
|
|
|
|
|
|
| 16 |
if isinstance(obj, (np.ndarray, np.generic)):
|
| 17 |
-
if isinstance(obj, np.bool_):
|
| 18 |
-
return bool(obj)
|
| 19 |
if hasattr(obj, "tolist"):
|
| 20 |
return obj.tolist()
|
| 21 |
return str(obj)
|
|
@@ -24,11 +24,7 @@ class SimulationEncoder(json.JSONEncoder):
|
|
| 24 |
try:
|
| 25 |
return super().default(obj)
|
| 26 |
except TypeError:
|
| 27 |
-
|
| 28 |
-
return str(obj)
|
| 29 |
-
except Exception:
|
| 30 |
-
raise
|
| 31 |
-
|
| 32 |
DEFAULT_HISTORY_PATH = Path("data/run_history.json")
|
| 33 |
|
| 34 |
|
|
|
|
| 13 |
return int(obj)
|
| 14 |
if isinstance(obj, (np.floating, np.float64, np.float32, np.float16)):
|
| 15 |
return float(obj)
|
| 16 |
+
if isinstance(obj, (np.bool_, bool)):
|
| 17 |
+
return bool(obj)
|
| 18 |
if isinstance(obj, (np.ndarray, np.generic)):
|
|
|
|
|
|
|
| 19 |
if hasattr(obj, "tolist"):
|
| 20 |
return obj.tolist()
|
| 21 |
return str(obj)
|
|
|
|
| 24 |
try:
|
| 25 |
return super().default(obj)
|
| 26 |
except TypeError:
|
| 27 |
+
return str(obj)
|
|
|
|
|
|
|
|
|
|
|
|
|
| 28 |
DEFAULT_HISTORY_PATH = Path("data/run_history.json")
|
| 29 |
|
| 30 |
|