|
13 | 13 | <script src="https://cdn.jsdelivr.net/npm/jquery"></script> |
14 | 14 | <script src="https://cdn.jsdelivr.net/npm/jquery.terminal@2.35.2/js/jquery.terminal.min.js"></script> |
15 | 15 | <script src="https://cdn.jsdelivr.net/npm/jquery.terminal@2.35.2/js/unix_formatting.min.js"></script> |
16 | | - <link |
17 | | - href="https://cdn.jsdelivr.net/npm/jquery.terminal@2.35.2/css/jquery.terminal.min.css" |
18 | | - rel="stylesheet" |
19 | | - /> |
| 16 | + <link href="https://cdn.jsdelivr.net/npm/jquery.terminal@2.35.2/css/jquery.terminal.min.css" rel="stylesheet" /> |
20 | 17 | <link |
21 | 18 | href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'><text y='.9em' font-size='90'>🐍</text></svg>" |
22 | 19 | rel="icon" |
|
89 | 86 | const buildParam = urlParams.get("build"); |
90 | 87 | if (buildParam) { |
91 | 88 | if (["full", "debug", "pyc"].includes(buildParam)) { |
92 | | - indexURL = indexURL.replace( |
93 | | - "/full/", |
94 | | - "/" + urlParams.get("build") + "/", |
95 | | - ); |
| 89 | + indexURL = indexURL.replace("/full/", "/" + urlParams.get("build") + "/"); |
96 | 90 | } else { |
97 | | - console.warn( |
98 | | - 'Invalid URL parameter: build="' + |
99 | | - buildParam + |
100 | | - '". Using default "full".', |
101 | | - ); |
| 91 | + console.warn('Invalid URL parameter: build="' + buildParam + '". Using default "full".'); |
102 | 92 | } |
103 | 93 | } |
104 | 94 | const { loadPyodide } = await import(indexURL + "pyodide.mjs"); |
|
113 | 103 | return result; |
114 | 104 | }, |
115 | 105 | }); |
116 | | - let { repr_shorten, BANNER, PyodideConsole } = |
117 | | - pyodide.pyimport("pyodide.console"); |
118 | | - BANNER = |
119 | | - `Welcome to the Pyodide ${pyodide.version} terminal emulator 🐍\n` + |
120 | | - BANNER; |
| 106 | + let { repr_shorten, BANNER, PyodideConsole } = pyodide.pyimport("pyodide.console"); |
| 107 | + BANNER = `Welcome to the Pyodide ${pyodide.version} terminal emulator 🐍\n` + BANNER; |
121 | 108 | const pyconsole = PyodideConsole(pyodide.globals); |
122 | 109 |
|
123 | 110 | const namespace = pyodide.globals.get("dict")(); |
|
134 | 121 |
|
135 | 122 | await_fut |
136 | 123 | `, |
137 | | - { globals: namespace }, |
| 124 | + { globals: namespace } |
138 | 125 | ); |
139 | 126 | namespace.destroy(); |
140 | 127 |
|
141 | 128 | const echo = (msg, ...opts) => |
142 | | - term.echo( |
143 | | - msg |
144 | | - .replaceAll("]]", "]]") |
145 | | - .replaceAll("[[", "[["), |
146 | | - ...opts, |
147 | | - ); |
| 129 | + term.echo(msg.replaceAll("]]", "]]").replaceAll("[[", "[["), ...opts); |
148 | 130 |
|
149 | 131 | const ps1 = ">>> "; |
150 | 132 | const ps2 = "... "; |
|
188 | 170 | echo( |
189 | 171 | repr_shorten.callKwargs(value, { |
190 | 172 | separator: "\n<long output truncated>\n", |
191 | | - }), |
| 173 | + }) |
192 | 174 | ); |
193 | 175 | } |
194 | 176 | if (value instanceof pyodide.ffi.PyProxy) { |
|
248 | 230 | term.error(e); |
249 | 231 | term.error("Pyodide exited and can no longer be used."); |
250 | 232 | } else { |
251 | | - term.error( |
252 | | - "Pyodide has suffered a fatal error. Please report this to the Pyodide maintainers.", |
253 | | - ); |
| 233 | + term.error("Pyodide has suffered a fatal error. Please report this to the Pyodide maintainers."); |
254 | 234 | term.error("The cause of the fatal error was:"); |
255 | 235 | term.error(e); |
256 | 236 | term.error("Look in the browser console for more details."); |
|
269 | 249 | let idbkvPromise; |
270 | 250 | async function getIDBKV() { |
271 | 251 | if (!idbkvPromise) { |
272 | | - idbkvPromise = await import( |
273 | | - "https://unpkg.com/idb-keyval@5.0.2/dist/esm/index.js" |
274 | | - ); |
| 252 | + idbkvPromise = await import("https://unpkg.com/idb-keyval@5.0.2/dist/esm/index.js"); |
275 | 253 | } |
276 | 254 | return idbkvPromise; |
277 | 255 | } |
|
290 | 268 | directoryHandle = await showDirectoryPicker(opts); |
291 | 269 | await set(directoryKey, directoryHandle); |
292 | 270 | } |
293 | | - const permissionStatus = |
294 | | - await directoryHandle.requestPermission(opts); |
| 271 | + const permissionStatus = await directoryHandle.requestPermission(opts); |
295 | 272 | if (permissionStatus !== "granted") { |
296 | 273 | throw new Error("readwrite access to directory not granted"); |
297 | 274 | } |
|
0 commit comments