@@ -176,10 +176,10 @@ def _jupyterlab_variableinspector_dict_list():
176176 vardic = [
177177 {
178178 'varName': _v,
179- 'varType': type(eval(_v)).__name__,
180- 'varSize': str(_jupyterlab_variableinspector_getsizeof(eval(_v))),
181- 'varShape': str(_jupyterlab_variableinspector_getshapeof(eval(_v))) if _jupyterlab_variableinspector_getshapeof(eval(_v)) else '',
182- 'varContent': str(_jupyterlab_variableinspector_getcontentof(eval(_v))),
179+ 'varType': type(eval(_v)).__name__,
180+ 'varSize': str(_jupyterlab_variableinspector_getsizeof(eval(_v))),
181+ 'varShape': str(_jupyterlab_variableinspector_getshapeof(eval(_v))) if _jupyterlab_variableinspector_getshapeof(eval(_v)) else '',
182+ 'varContent': str(_jupyterlab_variableinspector_getcontentof(eval(_v))),
183183 'isMatrix': _jupyterlab_variableinspector_is_matrix(eval(_v)),
184184 'isWidget': _jupyterlab_variableinspector_is_widget(type(eval(_v)))
185185 }
@@ -226,7 +226,7 @@ def _jupyterlab_variableinspector_displaywidget(widget):
226226
227227
228228def _jupyterlab_variableinspector_default(o):
229- if isinstance(o, __np.number): return int(o)
229+ if isinstance(o, __np.number): return int(o)
230230 raise TypeError
231231
232232
@@ -236,10 +236,10 @@ def _jupyterlab_variableinspector_deletevariable(x):
236236
237237 static r_script = `library(repr)
238238
239- .ls.objects = function (pos = 1, pattern, order.by, decreasing = FALSE, head = FALSE,
240- n = 5)
239+ .ls.objects = function (pos = 1, pattern, order.by, decreasing = FALSE, head = FALSE,
240+ n = 5)
241241{
242- napply <- function(names, fn) sapply(names, function(x) fn(get(x,
242+ napply <- function(names, fn) sapply(names, function(x) fn(get(x,
243243 pos = pos)))
244244 names <- ls(pos = pos, pattern = pattern)
245245 if (length(names) == 0) {
@@ -251,11 +251,11 @@ def _jupyterlab_variableinspector_deletevariable(x):
251251 obj.size <- napply(names, object.size)
252252 obj.dim <- t(napply(names, function(x) as.numeric(dim(x))[1:2]))
253253 obj.content <- rep("NA", length(names))
254- has_no_dim <- is.na(obj.dim)[1:length(names)]
254+ has_no_dim <- is.na(obj.dim)[1:length(names)]
255255 obj.dim[has_no_dim, 1] <- napply(names, length)[has_no_dim]
256256 vec <- (obj.type != "function")
257257 obj.content[vec] <- napply(names[vec], function(x) toString(x, width = 154)[1])
258-
258+
259259 obj.rownames <- napply(names, rownames)
260260 has_rownames <- obj.rownames != "NULL"
261261 obj.rownames <- sapply(obj.rownames[has_rownames], function(x) paste(x,
@@ -264,24 +264,24 @@ def _jupyterlab_variableinspector_deletevariable(x):
264264 obj.rownames <- ifelse(nchar(obj.rownames) > 154, obj.rownames.short, obj.rownames)
265265 obj.rownames <- sapply(obj.rownames, function(x) paste("Row names: ",x))
266266 obj.content[has_rownames] <- obj.rownames
267-
268-
267+
268+
269269 obj.colnames <- napply(names, colnames)
270270 has_colnames <- obj.colnames != "NULL"
271- obj.colnames <- sapply(obj.colnames[has_colnames], function(x) paste(x,
271+ obj.colnames <- sapply(obj.colnames[has_colnames], function(x) paste(x,
272272 collapse = ", "))
273- obj.colnames.short <- sapply(obj.colnames, function(x) paste(substr(x,
273+ obj.colnames.short <- sapply(obj.colnames, function(x) paste(substr(x,
274274 1, 150), "...."))
275- obj.colnames <- ifelse(nchar(obj.colnames) > 154, obj.colnames.short,
275+ obj.colnames <- ifelse(nchar(obj.colnames) > 154, obj.colnames.short,
276276 obj.colnames)
277277 obj.colnames <- sapply(obj.colnames, function(x) paste("Column names: ",x))
278-
278+
279279 obj.content[has_colnames] <- obj.colnames
280-
280+
281281 is_function <- (obj.type == "function")
282282 obj.content[is_function] <- napply(names[is_function], function(x) paste(strsplit(repr_text(x),")")[[1]][1],")",sep=""))
283283 obj.content <- unlist(obj.content, use.names = FALSE)
284-
284+
285285
286286 out <- data.frame(obj.type, obj.size, obj.dim)
287287 names(out) <- c("varType", "varSize", "Rows", "Columns")
@@ -292,10 +292,10 @@ def _jupyterlab_variableinspector_deletevariable(x):
292292 out <- out[, !(names(out) %in% c("Rows", "Columns"))]
293293 rownames(out) <- NULL
294294 print(out)
295- if (!missing(order.by))
296- out <- out[order(out[[order.by]], decreasing = decreasing),
295+ if (!missing(order.by))
296+ out <- out[order(out[[order.by]], decreasing = decreasing),
297297 ]
298- if (head)
298+ if (head)
299299 out <- head(out, n)
300300 jsonlite::toJSON(out)
301301}
0 commit comments