Skip to content

Commit 316ae8c

Browse files
committed
Add json formatter for list
1 parent c1875da commit 316ae8c

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

template/startup_scripts/0002_data.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,15 @@ def __call__(self, obj):
4848
return super().__call__(obj)
4949

5050

51-
class E2BDictFormatter(JSONFormatter):
51+
class E2BJSONFormatter(JSONFormatter):
5252
def __call__(self, obj):
5353
# Figure object is for some reason removed on execution of the cell,
5454
# so it can't be used in type_printers or with top-level import
5555

5656
if isinstance(obj, dict):
5757
return obj, {"expanded": True}
58+
if isinstance(obj, list):
59+
return obj, {"expanded": True}
5860
return super().__call__(obj)
5961

6062

@@ -66,6 +68,6 @@ def __call__(self, obj):
6668
parent=ip.display_formatter
6769
)
6870

69-
ip.display_formatter.formatters["application/json"] = E2BDictFormatter(
71+
ip.display_formatter.formatters["application/json"] = E2BJSONFormatter(
7072
parent=ip.display_formatter
7173
)

0 commit comments

Comments
 (0)