Skip to content

Commit f34ad70

Browse files
author
minjk-bl
committed
Hotfix for using metadata from notebook
1 parent 84361a6 commit f34ad70

File tree

2 files changed

+15
-4
lines changed

2 files changed

+15
-4
lines changed

js/com/com_Config.js

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,17 @@ define([], function() {
9090
' except ValueError:',
9191
' return 0.0'
9292
]
93-
}
93+
},
94+
'vpimport': [
95+
{ library: 'numpy', alias:'np' },
96+
{ library: 'pandas', alias:'pd' },
97+
{ library: 'matplotlib.pyplot', alias:'plt',
98+
include: [
99+
'%matplotlib inline'
100+
]
101+
},
102+
{ library: 'seaborn', alias:'sns' }
103+
]
94104
}
95105

96106
this.data = {
@@ -165,7 +175,8 @@ define([], function() {
165175
Jupyter.notebook.config.loaded.then(function() {
166176
var data = Jupyter.notebook.config.data[configKey];
167177
if (data == undefined) {
168-
data = {};
178+
reject('No data available.');
179+
return;
169180
}
170181
if (dataKey == '') {
171182
resolve(data);
@@ -184,7 +195,7 @@ define([], function() {
184195
Jupyter.notebook.config.load();
185196
var data = Jupyter.notebook.config.data[configKey];
186197
if (data == undefined) {
187-
data = {};
198+
return undefined;
188199
}
189200
if (dataKey == '') {
190201
return data;

js/m_apps/Import.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ define([
8181
page.appendLine('</tr></thead>');
8282
page.appendLine('<tbody>');
8383
let that = this;
84-
this.state.importMeta.forEach((lib, idx) => {
84+
this.state.importMeta && this.state.importMeta.forEach((lib, idx) => {
8585
page.appendLine(that.templateForLibrary(idx, lib.library, lib.alias));
8686
});
8787
page.appendLine('</tbody>');

0 commit comments

Comments
 (0)