Skip to content

Commit 72075b3

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent 2b52a06 commit 72075b3

File tree

2 files changed

+15
-10
lines changed

2 files changed

+15
-10
lines changed

pyscript.core/src/plugins/py-editor.js

+14-10
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,7 @@ const hooks = {
2525
};
2626

2727
const validate = (config, result) => {
28-
if (typeof result === 'boolean')
29-
throw `Invalid source: ${config}`;
28+
if (typeof result === "boolean") throw `Invalid source: ${config}`;
3029
return result;
3130
};
3231

@@ -52,20 +51,23 @@ async function execute({ currentTarget }) {
5251
details.configURL = relative_url(config);
5352
if (config.endsWith(".toml")) {
5453
const [{ parse }, toml] = await Promise.all([
55-
import(/* webpackIgnore: true */ "../3rd-party/toml.js"),
56-
fetch(config).then((r) => (r.ok && r.text())),
54+
import(
55+
/* webpackIgnore: true */ "../3rd-party/toml.js"
56+
),
57+
fetch(config).then((r) => r.ok && r.text()),
5758
]);
5859
details.config = parse(validate(config, toml));
5960
} else if (config.endsWith(".json")) {
60-
const json = await fetch(config).then((r) => (r.ok && r.json()));
61+
const json = await fetch(config).then(
62+
(r) => r.ok && r.json(),
63+
);
6164
details.config = validate(config, json);
6265
} else {
6366
details.configURL = relative_url("./config.txt");
6467
details.config = JSON.parse(config);
6568
}
6669
details.version = offline_interpreter(details.config);
67-
}
68-
catch(error) {
70+
} catch (error) {
6971
notify(error);
7072
return;
7173
}
@@ -212,9 +214,11 @@ const init = async (script, type, interpreter) => {
212214
const { src } = script;
213215
if (src) {
214216
try {
215-
source = validate(src, await fetch(src).then((b) => (b.ok && b.text())));
216-
}
217-
catch (error) {
217+
source = validate(
218+
src,
219+
await fetch(src).then((b) => b.ok && b.text()),
220+
);
221+
} catch (error) {
218222
notify(error);
219223
return;
220224
}
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
import sys
2+
23
print(sys.shenanigans)

0 commit comments

Comments
 (0)