Skip to content

Commit 3d6eac7

Browse files
committed
Add and run trailing-whitespace
1 parent 2ba3dbd commit 3d6eac7

File tree

18 files changed

+49
-45
lines changed

18 files changed

+49
-45
lines changed

.github/workflows/lint.yml

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,19 @@
11
name: Lint
22

33
on:
4-
push:
5-
branches: main
6-
pull_request:
7-
branches: '*'
4+
5+
push: # Only run on merges into master that modify files under pyscriptjs/
6+
branches:
7+
- main
8+
9+
pull_request: # Run on any PR that modifies files in pyscriptjs/
810

911
jobs:
1012
build:
1113
runs-on: ubuntu-latest
14+
defaults:
15+
run:
16+
working-directory: ./pyscriptjs
1217
steps:
1318
- name: Checkout
1419
uses: actions/checkout@v3
@@ -30,9 +35,7 @@ jobs:
3035
${{ runner.os }}-
3136
- name: Install dependencies
3237
run: |
33-
cd pyscriptjs
3438
npm install
3539
- name: Run linter
3640
run: |
37-
cd pyscriptjs
3841
npm run lint

.pre-commit-config.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ repos:
88
hooks:
99
- id: end-of-file-fixer
1010
exclude: ".*.min.js"
11+
- id: trailing-whitespace
1112
- repo: https://github.com/psf/black
1213
rev: 22.3.0
1314
hooks:

GETTING-STARTED.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ HTML head. You can also link to `.whl` files directly on disk like in our [toga
124124
</py-env>
125125
```
126126

127-
If your `.whl` is not a pure Python wheel, then open a PR or issue with [pyodide](https://github.com/pyodide/pyodide) to get it added [here](https://github.com/pyodide/pyodide/tree/main/packages).
127+
If your `.whl` is not a pure Python wheel, then open a PR or issue with [pyodide](https://github.com/pyodide/pyodide) to get it added [here](https://github.com/pyodide/pyodide/tree/main/packages).
128128
If there's enough popular demand the pyodide team will likely work on supporting your package, regardless things will likely move faster if you make the PR and consult with the team to get unblocked.
129129

130130
For example, NumPy and Matplotlib are available. Notice here we're using `<py-script output="plot">`

pyscriptjs/examples/bokeh.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@
1212
Bokeh.set_log_level("info");
1313
</script>
1414
<link rel="stylesheet" href="../build/pyscript.css" />
15-
15+
1616
<script defer src="../build/pyscript.js"></script>
17-
17+
1818
</head>
1919
<body>
2020
<py-env>
@@ -23,7 +23,7 @@
2323
</py-env>
2424
<h1>Bokeh Example</h1>
2525
<div id="myplot"></div>
26-
26+
2727
<py-script id="main">
2828
import json
2929
import pyodide
@@ -43,6 +43,6 @@ <h1>Bokeh Example</h1>
4343

4444
Bokeh.embed.embed_item(JSON.parse(p_json))
4545
</py-script>
46-
46+
4747
</body>
4848
</html>

pyscriptjs/examples/bokeh_interactive.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@
1212
Bokeh.set_log_level("info");
1313
</script>
1414
<link rel="stylesheet" href="../build/pyscript.css" />
15-
15+
1616
<script defer src="../build/pyscript.js"></script>
17-
17+
1818
</head>
1919
<body>
2020
<py-env>
@@ -23,7 +23,7 @@
2323
</py-env>
2424
<h1>Bokeh Example</h1>
2525
<div id="myplot"></div>
26-
26+
2727
<py-script id="main">
2828
import asyncio
2929
import json
@@ -93,6 +93,6 @@ <h1>Bokeh Example</h1>
9393

9494
await show(row, 'myplot')
9595
</py-script>
96-
96+
9797
</body>
9898
</html>

pyscriptjs/examples/folium.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
import folium
1717
import json
1818
import pandas as pd
19-
19+
2020
from pyodide.http import open_url
2121

2222
url = (

pyscriptjs/examples/handtrack/say_hello.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
<link rel="icon" type="image/png" href="favicon.png" />
1010
<link rel="stylesheet" href="../../build/pyscript.css" />
11-
11+
1212
<script defer src="../../build/pyscript.js"></script>
1313
</head>
1414

@@ -40,7 +40,7 @@
4040
handTrack.stopVideo(video.element)
4141
isVideo = False
4242
update_note.write("Video stopped")
43-
43+
4444
async def start_video():
4545
global isVideo
4646
update_note.write("Inside sstart video")
@@ -61,9 +61,9 @@
6161
console.log("in RUN DETECTION: ");
6262
global model
6363
global isVideo
64-
64+
6565
console.log("...1")
66-
66+
6767
predictions = await model.detect(video.element)
6868
console.log("done...1")
6969
console.log("Predictions: ", predictions);

pyscriptjs/examples/hello_world.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
<link rel="icon" type="image/png" href="favicon.png" />
1010
<link rel="stylesheet" href="../build/pyscript.css" />
11-
11+
1212
<script defer src="../build/pyscript.js"></script>
1313
</head>
1414

pyscriptjs/examples/mario/play_mario.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
<link rel="icon" type="image/png" href="../favicon.png" />
1010
<link rel="stylesheet" href="../../build/pyscript.css" />
11-
11+
1212
<script defer src="../../build/pyscript.js"></script>
1313
</head>
1414

@@ -69,7 +69,7 @@
6969
handTrack.stopVideo(video.element)
7070
isVideo = False
7171
update_note.write("Video stopped")
72-
72+
7373
async def start_video():
7474
global isVideo
7575
update_note.write("Inside sstart video")
@@ -91,7 +91,7 @@
9191
global isVideo
9292
global last_position
9393
global direction
94-
94+
9595
predictions = await model.detect(video.element)
9696
model.renderPredictions(predictions, canvas.element, context, video.element);
9797

pyscriptjs/examples/panel_deckgl.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
<link rel="stylesheet" href="../build/pyscript.css" />
4242
<script defer src="../build/pyscript.js"></script>
4343
</head>
44-
<body>
44+
<body>
4545
<py-env>
4646
- bokeh
4747
- numpy

pyscriptjs/examples/panel_kmeans.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
<script type="text/javascript">
2727
Bokeh.set_log_level("info");
2828
</script>
29-
29+
3030
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.6.1/dist/css/bootstrap.min.css">
3131
<link rel="stylesheet" href="https://unpkg.com/@holoviz/panel@0.13.0/dist/bundled/bootstraptemplate/bootstrap.css">
3232
<link rel="stylesheet" href="https://unpkg.com/@holoviz/panel@0.13.0/dist/bundled/defaulttheme/default.css">
@@ -43,7 +43,7 @@
4343
<link rel="stylesheet" href="../build/pyscript.css" />
4444
<script defer src="../build/pyscript.js"></script>
4545
</head>
46-
46+
4747
<py-env>
4848
- altair
4949
- numpy

pyscriptjs/examples/repl2.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
<link rel="icon" type="image/png" href="favicon.png" />
1010
<link rel="stylesheet" href="../build/pyscript.css" />
1111
<link rel="stylesheet" href="repl.css" />
12-
12+
1313
<script defer src="../build/pyscript.js"></script>
1414
</head>
1515

pyscriptjs/examples/simple_clock.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
<link rel="icon" type="image/png" href="favicon.png" />
1010
<link rel="stylesheet" href="../build/pyscript.css" />
11-
11+
1212
<script defer src="../build/pyscript.js"></script>
1313
<py-env>
1414
- paths:
@@ -34,7 +34,7 @@
3434
await asyncio.sleep(1)
3535
output = now()
3636
pyscript.write("outputDiv2", output)
37-
37+
3838
out3 = Element("outputDiv3")
3939
if output[-1] in ["0", "4", "8"]:
4040
out3.write("It's espresso time!")

pyscriptjs/examples/todo-pylist.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
<link rel="icon" type="image/png" href="favicon.png" />
99
<link rel="stylesheet" href="/build/pyscript.css" />
10-
10+
1111
<script defer src="/build/pyscript.js"></script>
1212
<py-env>
1313
- paths:

pyscriptjs/examples/todo.html

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
<link rel="icon" type="image/png" href="favicon.png" />
1010
<link rel="stylesheet" href="/build/pyscript.css" />
11-
11+
1212
<script defer src="/build/pyscript.js"></script>
1313
<py-env>
1414
- paths:
@@ -22,7 +22,7 @@
2222

2323
<main class="max-w-xs mx-auto mt-4">
2424
<section>
25-
25+
2626
<div class="text-center w-full mb-8">
2727
<h1 class="text-3xl font-bold text-gray-800 uppercase tracking-tight">To Do List</h1>
2828
</div>
@@ -32,20 +32,20 @@ <h1 class="text-3xl font-bold text-gray-800 uppercase tracking-tight">To Do List
3232
Add task
3333
</button>
3434
</div>
35-
35+
3636
<py-list id="myList"></py-list>
3737
<div id="list-tasks-container" class="flex flex-col-reverse mt-4">
3838
</div>
39-
39+
4040
<template id="task-template">
4141
<section class="task bg-white my-1">
4242
<label for="flex items-center p-2 ">
4343
<input class="mr-2" type="checkbox" class="task-check">
4444
<p class="m-0 inline"></p>
4545
</label>
46-
</section>
46+
</section>
4747
</template>
48-
48+
4949
</section>
5050
</main>
5151
</body>

pyscriptjs/examples/webgl/raycaster/style.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ canvas {
2828
a, a:hover, a:visited {
2929
color: red;
3030
text-decoration: none;
31-
}
31+
}
3232
.disable-selection {
3333
-moz-user-select: none; /* Firefox */
3434
-ms-user-select: none; /* Internet Explorer */

pyscriptjs/src/components/base.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ export class BaseEvalElement extends HTMLElement {
145145
Element = pyodide.globals.get('Element');
146146
}
147147
const out = Element(this.errorElement.id);
148-
148+
149149
addClasses(this.errorElement, ['bg-red-200', 'p-2']);
150150
out.write.callKwargs(err, { append : true});
151151
this.errorElement.hidden = false;

pyscriptjs/src/components/pyrepl.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -75,39 +75,39 @@ export class PyRepl extends BaseEvalElement {
7575
'.cm-content': { padding: 0, backgroundColor: '#f5f5f5' },
7676
'&.cm-focused .cm-content': { border: '1px solid #1876d2' }
7777
});
78-
78+
7979
if (!this.hasAttribute('theme')) {
8080
this.theme = this.getAttribute('theme');
8181
if (this.theme == 'dark'){
8282
extensions.push(oneDarkTheme);
8383
}
8484
extensions.push(customTheme);
8585
}
86-
86+
8787
const startState = EditorState.create({
8888
doc: this.code.trim(),
8989
extensions: extensions
9090
});
91-
91+
9292
this.editor = new EditorView({
9393
state: startState,
9494
parent: this.editorNode
9595
});
96-
96+
9797
const mainDiv = document.createElement('div');
9898
addClasses(mainDiv, ["parentBox", "flex", "flex-col", "mt-2", "mx-8", "relative"])
9999

100100
// add Editor to main PyScript div
101101
mainDiv.appendChild(this.editorNode);
102-
102+
103103
// Play Button
104104
this.btnRun = document.createElement('button');
105105
this.btnRun.innerHTML = '<svg id="" class="svelte-fa svelte-ps5qeg" style="height:20px;width:20px;vertical-align:-.125em;transform-origin:center;overflow:visible;color:green" viewBox="0 0 384 512" aria-hidden="true" role="img" xmlns="http://www.w3.org/2000/svg"><g transform="translate(192 256)" transform-origin="96 0"><g transform="translate(0,0) scale(1,1)"><path d="M361 215C375.3 223.8 384 239.3 384 256C384 272.7 375.3 288.2 361 296.1L73.03 472.1C58.21 482 39.66 482.4 24.52 473.9C9.377 465.4 0 449.4 0 432V80C0 62.64 9.377 46.63 24.52 38.13C39.66 29.64 58.21 29.99 73.03 39.04L361 215z" fill="currentColor" transform="translate(-192 -256)"></path></g></g></svg>';
106106
addClasses(this.btnRun, ["absolute", "right-1", "bottom-3", "opacity-0", "group-hover:opacity-100"]);
107107
this.editorNode.appendChild(this.btnRun);
108108

109109
this.btnRun.onclick = wrap(this);
110-
110+
111111
function wrap(el: any){
112112
function evaluatePython() {
113113
el.evaluate();

0 commit comments

Comments
 (0)