We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 083b11d commit 6059827Copy full SHA for 6059827
1 file changed
template/startup_scripts/0002_data.py
@@ -50,18 +50,12 @@ def __call__(self, obj):
50
51
class E2BJSONFormatter(JSONFormatter):
52
def __call__(self, obj):
53
- # Figure object is for some reason removed on execution of the cell,
54
- # so it can't be used in type_printers or with top-level import
55
-
56
- if isinstance(obj, dict):
57
- return orjson.loads(orjson.dumps(obj, option=orjson.OPT_SERIALIZE_NUMPY)), {
58
- "expanded": True
59
- }
60
61
- if isinstance(obj, list):
62
63
64
+ if isinstance(obj, (list, dict)):
+ return orjson.loads(
+ orjson.dumps(
+ obj, option=orjson.OPT_SERIALIZE_NUMPY | orjson.OPT_NON_STR_KEYS
+ )
+ ), {"expanded": True}
65
66
return super().__call__(obj)
67
0 commit comments