@@ -101,7 +101,14 @@ def _jupyterlab_variableinspector_getshapeof(x):
101
101
def _jupyterlab_variableinspector_getcontentof(x):
102
102
# returns content in a friendly way for python variables
103
103
# pandas and numpy
104
- if __pd and isinstance(x, __pd.DataFrame):
104
+ if isinstance(x, (bool, str, int, float, type(None))):
105
+ content = str(x)
106
+ elif isinstance(x, (list, tuple)):
107
+ if len(x) < 10:
108
+ content = str(x)
109
+ else:
110
+ content = f"[{x[0]}, {x[1]}, {x[2]}, ..., {x[-1]}]"
111
+ elif __pd and isinstance(x, __pd.DataFrame):
105
112
colnames = ', '.join(x.columns.map(str))
106
113
content = "Columns: %s" % colnames
107
114
elif __pd and isinstance(x, __pd.Series):
@@ -152,7 +159,7 @@ def _jupyterlab_variableinspector_dict_list():
152
159
def keep_cond(v):
153
160
try:
154
161
obj = eval(v)
155
- if isinstance(obj, (bool, str, list, int, float, type(None))):
162
+ if isinstance(obj, (bool, str, list, tuple, int, float, type(None))):
156
163
return True
157
164
if __tf and isinstance(obj, __tf.Variable):
158
165
return True
0 commit comments