MCPcopy Create free account
hub / github.com/SplootCode/splootcode / loadModule

Function loadModule

packages/runtime-python/src/webworker.ts:227–244  ·  view source on GitHub ↗
(moduleName)

Source from the content-addressed store, hash-verified

225}
226
227const loadModule = async (moduleName) => {
228 try {
229 const res = pyodide.runPython(`generate_module_info("${moduleName}")`)
230 if (!res) {
231 // Returns None if module does not exist or cannot be imported.
232 return
233 }
234 const jsResult = res.toJs({ dict_converter: Object.fromEntries })
235 if (jsResult) {
236 sendMessage({
237 type: 'module_info',
238 info: jsResult,
239 })
240 }
241 } catch (err) {
242 console.warn(err)
243 }
244}
245
246const getWorkspace = () => {
247 return workspace

Callers 1

webworker.tsFile · 0.85

Calls 1

sendMessageFunction · 0.70

Tested by

no test coverage detected