MCPcopy Create free account
hub / github.com/OpenBitSys/BitDistiller / json_serial

Function json_serial

test/general/lm_eval/decontamination/archiver.py:12–17  ·  view source on GitHub ↗

JSON serializer for objects not serializable by default json code

(obj)

Source from the content-addressed store, hash-verified

10
11
12def json_serial(obj):
13 """JSON serializer for objects not serializable by default json code"""
14
15 if isinstance(obj, (datetime.datetime,)):
16 return obj.isoformat()
17 raise TypeError("Type %s not serializable" % type(obj))
18
19
20# Modified version of lm_dataformat Archive for single file.

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected