Skip to content

Commit

Permalink
Remove iodide specific code (pyodide#878)
Browse files Browse the repository at this point in the history
Iodide is no longer actively maintained, and in any case it would make
more sense for iodide-specific code to belong to iodide.
  • Loading branch information
dalcde authored and joemarshall committed Jan 3, 2021
1 parent dfc3fad commit 394c353
Showing 1 changed file with 0 additions and 49 deletions.
49 changes: 0 additions & 49 deletions src/pyodide.js
Original file line number Diff line number Diff line change
Expand Up @@ -327,12 +327,6 @@ var languagePluginLoader = new Promise((resolve, reject) => {
self.pyodide.runPython('import sys\nsys.modules["__main__"]');
self.pyodide = makePublicAPI(self.pyodide, PUBLIC_API);
self.pyodide._module.packages = json;
if (self.iodide !== undefined) {
// Perform some completions immediately so there isn't a delay on
// the first call to autocomplete
self.pyodide.runPython('import pyodide');
self.pyodide.runPython('pyodide.get_completions("")');
}
resolve();
});
};
Expand Down Expand Up @@ -362,49 +356,6 @@ loadScript(data_script_src, () => {
self.pyodide.loadPackage = loadPackage;
}, () => {});
}, () => {});

////////////////////////////////////////////////////////////
// Iodide-specific functionality, that doesn't make sense
// if not using with Iodide.
if (self.iodide !== undefined) {
// Load the custom CSS for Pyodide
let link = document.createElement('link');
link.rel = 'stylesheet';
link.type = 'text/css';
link.href = `${baseURL}renderedhtml.css`;
document.getElementsByTagName('head')[0].appendChild(link);

// Add a custom output handler for Python objects
self.iodide.addOutputRenderer({
shouldRender : (val) => {
return (typeof val === 'function' &&
pyodide._module.PyProxy.isPyProxy(val));
},

render : (val) => {
let div = document.createElement('div');
div.className = 'rendered_html';
var element;
if (val._repr_html_ !== undefined) {
let result = val._repr_html_();
if (typeof result === 'string') {
div.appendChild(new DOMParser()
.parseFromString(result, 'text/html')
.body.firstChild);
element = div;
} else {
element = result;
}
} else {
let pre = document.createElement('pre');
pre.textContent = val.toString();
div.appendChild(pre);
element = div;
}
return element.outerHTML;
}
});
}
});
languagePluginLoader
*/

0 comments on commit 394c353

Please sign in to comment.