Skip to content

Commit 2037433

Browse files
committed
Fixed formatting and linting issues
1 parent 0a5ae99 commit 2037433

File tree

5 files changed

+27
-7
lines changed

5 files changed

+27
-7
lines changed

brython/async/aio/main.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,22 @@
11
from browser import aio, document
22
import javascript
33

4+
45
def log(message):
56
document["log"].value += f"{message} \n"
67

8+
79
async def process_get(url):
810
log("Before await aio.get")
911
req = await aio.get(url)
1012
log(f"Retrieved data: '{req.data}'")
1113
return req.data
1214

15+
1316
def aio_get(evt):
1417
log("Before aio.run")
1518
aio.run(process_get("/api.txt"))
1619
log("After aio.run")
1720

21+
1822
document["get-btn"].bind("click", aio_get)

brython/async/ajax/main.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,35 @@
11
from browser import ajax, document
22
import javascript
33

4+
45
def show_text(req):
56
if req.status == 200:
67
log(f"Text received: '{req.text}'")
78
else:
89
log(f"Error: {req.status} - {req.text}")
910

11+
1012
def log(message):
1113
document["log"].value += f"{message} \n"
1214

15+
1316
def ajax_get(evt):
1417
log("Before async get")
1518
ajax.get("/api.txt", oncomplete=show_text)
1619
log("After async get")
1720

21+
1822
def ajax_get_blocking(evt):
1923
log("Before blocking get")
2024
try:
2125
ajax.get("/api.txt", blocking=True, oncomplete=show_text)
2226
except Exception as exc:
23-
log(f"Error: {exc.__name__} - Did you start a web server (ex: 'python3 -m http.server')?")
27+
log(
28+
f"Error: {exc.__name__} - Did you start a web server (ex: 'python3 -m http.server')?"
29+
)
2430
else:
2531
log("After blocking get")
2632

33+
2734
document["get-btn"].bind("click", ajax_get)
2835
document["get-blocking-btn"].bind("click", ajax_get_blocking)
29-

brython/base64/sep/main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from browser import document, prompt, html # type: ignore
1+
from browser import document, prompt, html # type: ignore
22
import base64
33

44
b64_map = {}

brython/vuejs/main.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,12 @@ def created():
3232
{
3333
"el": "#app",
3434
"created": created,
35-
"data": lambda _: {"hash_value": "", "algos": [], "algo": "", "input_text": ""},
35+
"data": lambda _: {
36+
"hash_value": "",
37+
"algos": [],
38+
"algo": "",
39+
"input_text": "",
40+
},
3641
"methods": {"compute_hash": compute_hash},
3742
}
3843
)

brython/wasm/op/web/main.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,20 @@
22

33
double_first_and_add = None
44

5+
56
def add_rust_fn(module):
6-
global double_first_and_add
7-
double_first_and_add = module.instance.exports.double_first_and_add
7+
global double_first_and_add
8+
double_first_and_add = module.instance.exports.double_first_and_add
9+
810

911
def add_numbers(evt):
1012
nb1 = document["number-1"].value or 0
1113
nb2 = document["number-2"].value or 0
1214
res = double_first_and_add(nb1, nb2)
1315
document["result"].innerHTML = f"Result: ({nb1} * 2) + {nb2} = {res}"
1416

17+
1518
document["submit"].bind("click", add_numbers)
16-
window.WebAssembly.instantiateStreaming(window.fetch("op.wasm")).then(add_rust_fn)
19+
window.WebAssembly.instantiateStreaming(window.fetch("op.wasm")).then(
20+
add_rust_fn
21+
)

0 commit comments

Comments
 (0)