Fix syntax errors in html files, apply dos2unix, prettier everything (#1244)

* Fix syntax errors in html files

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
Hood Chatham
2023-03-03 12:59:49 +01:00
committed by GitHub
parent 4588e90226
commit 589c614e57
5 changed files with 131 additions and 135 deletions

View File

@@ -152,7 +152,7 @@
</a>
<p>
Demo showing how a Simple <a href="https://developer.mozilla.org/en-US/docs/Web/API/WebGL_API" target="_blank">WebGL</a>
scene would work in PyScript</code> tag
scene would work in the <code>&lt;py-script&gt;</code> tag
</p>
</div>
</div>

View File

@@ -43,21 +43,17 @@
classify the data. <br>
</p>
<p>
Currently the <code>&gt;</code> symbol is being imported incorrectly as <code>&ampgt;</code> into the REPL's.
Currently the <code>&gt;</code> symbol is being imported incorrectly as <code>&amp;gt;</code> into the REPL's.
In this app the <code>&gt;</code> symbol has been replaced with <code>().__gt__()</code> so you can run the code
without issue. Ex: instead of <code>a &gt; b</code>, you will see <code>(a).__gt__(b)</code> instead. <br>
</p>
<p>
<py-script>import js; js.document.getElementById('python-status').innerHTML = 'Python is now ready. You may proceed.'</py-script>
<div id="python-status">Python is currently starting. Please wait...</div>
</p>
<p>
<button id="run-all-button" class="btn btn-primary" type="submit" py-onClick="run_all_micrograd_demo()">Run All</button><br>
<py-script src="/micrograd_ai.py"></py-script>
<div id="micrograd-run-all-print-div"></div><br>
<div id="micrograd-run-all-fig1-div"></div>
<div id="micrograd-run-all-fig2-div"></div><br>
</p>
<py-script>import js; js.document.getElementById('python-status').innerHTML = 'Python is now ready. You may proceed.'</py-script>
<div id="python-status">Python is currently starting. Please wait...</div>
<button id="run-all-button" class="btn btn-primary" type="submit" py-onClick="run_all_micrograd_demo()">Run All</button><br>
<py-script src="/micrograd_ai.py"></py-script>
<div id="micrograd-run-all-print-div"></div><br>
<div id="micrograd-run-all-fig1-div"></div>
<div id="micrograd-run-all-fig2-div"></div><br>
</div>
<py-repl auto-generate="false">
import random

View File

@@ -334,8 +334,8 @@ async def main():
)
asyncio.ensure_future(main())
</py-script>
</py-script>
</py-tutor>
</section>
</py-tutor>
</body>
</html>

View File

@@ -1,120 +1,120 @@
<!DOCTYPE html>
<html>
<head>
<title id="header-title"></title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width,initial-scale=1" />
<link rel="icon" type="image/png" href="./favicon.png" />
<link rel="stylesheet" href="https://pyscript.net/latest/pyscript.css" />
<script defer src="https://pyscript.net/latest/pyscript.js"></script>
<link rel="stylesheet" href="./assets/css/examples.css" />
</head>
<body>
<nav class="navbar" style="background-color: #000000;">
<div class="app-header">
<a href="/">
<img src="./logo.png" class="logo">
</a>
<a class="title" id="page-title" href="" style="color: #f0ab3c;"></a>
</div>
</nav>
<br />
<div id="page-message"></div>
<div id="pandas-source">
<h3>Data Source</h3>
<input type="text" id="txt-url" class="py-input" size="70"></input>
<button type="submit" id="btn-load" class="py-button" py-click="loadFromURL()">Load CSV</button>
</div>
<div id="pandas-repl" hidden>
<h3>Python REPL</h3>
<py-repl id ="pandas-repl-inner" output="pandas-output-inner">
# Hit SHIFT + ENTER to execute example code
# Get all closed airports in Great Britain
df2 = df.query("type == 'closed' & iso_country == 'GB'")
df2
</py-repl>
</div>
<div id ="pandas-output" hidden>
<h3>Output</h3>
<div id="pandas-output-inner"></div>
</div>
<div id="pandas-dev-console" hidden>
<h3>Dev Console</h3>
<py-terminal auto></py-terminal>
</div>
<py-tutor>
<py-config>
plugins = [
"../build/plugins/python/py_tutor.py"
]
packages = ["pandas"]
</py-config>
<section class="pyscript">
<py-script>
import pandas as pd
from pyodide.http import open_url
import sys
title = "Pandas (and basic DOM manipulation)"
page_message = "This example loads a remote CSV file into a Pandas dataframe, displays it and lets you manipulate it through a Python REPL"
url = "https://raw.githubusercontent.com/datasets/airport-codes/master/data/airport-codes.csv"
Element("header-title").element.innerText = title
Element("page-title").element.innerText = title
Element("page-message").element.innerText = page_message
Element("txt-url").element.value = url
# Depending on the type of DOM element, there are several alternative methods to write to it
# Element("id-of-dom-element").write("example")
# Element("id-of-dom-element").innerText = "example"
# Element("id-of-dom-element").value = "example"
# Element("id-of-dom-element").element.innerText = "example"
# Element("id-of-dom-element").element.value = "example"
# js.document.getElementById("id-of-dom-element").innerText = "example"
# js.document.getElementById("id-of-dom-element").value = "example"
df = pd.DataFrame()
def loadFromURL(*ags, **kws):
global df
# clear dataframe & output
df = pd.DataFrame()
Element("pandas-output-inner").element.innerHTML = ""
url = Element("txt-url").element.value
log ("Trying to fetch CSV from " + url)
df = pd.read_csv(open_url(url))
Element("pandas-repl").element.style.display = "block"
Element("pandas-output").element.style.display = "block"
Element("pandas-dev-console").element.style.display = "block"
display (df, target="pandas-output-inner", append="False")
def log(message):
# log to pyscript dev console
print (message)
# log to JS console
js.console.log (message)
</py-script>
</section>
</py-tutor>
</body>
<!DOCTYPE html>
<html>
<head>
<title id="header-title"></title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width,initial-scale=1" />
<link rel="icon" type="image/png" href="./favicon.png" />
<link rel="stylesheet" href="https://pyscript.net/latest/pyscript.css" />
<script defer src="https://pyscript.net/latest/pyscript.js"></script>
<link rel="stylesheet" href="./assets/css/examples.css" />
</head>
<body>
<nav class="navbar" style="background-color: #000000;">
<div class="app-header">
<a href="/">
<img src="./logo.png" class="logo">
</a>
<a class="title" id="page-title" href="" style="color: #f0ab3c;"></a>
</div>
</nav>
<br />
<div id="page-message"></div>
<div id="pandas-source">
<h3>Data Source</h3>
<input type="text" id="txt-url" class="py-input" size="70">
<button type="submit" id="btn-load" class="py-button" py-click="loadFromURL()">Load CSV</button>
</div>
<div id="pandas-repl" hidden>
<h3>Python REPL</h3>
<py-repl id ="pandas-repl-inner" output="pandas-output-inner">
# Hit SHIFT + ENTER to execute example code
# Get all closed airports in Great Britain
df2 = df.query("type == 'closed' & iso_country == 'GB'")
df2
</py-repl>
</div>
<div id ="pandas-output" hidden>
<h3>Output</h3>
<div id="pandas-output-inner"></div>
</div>
<div id="pandas-dev-console" hidden>
<h3>Dev Console</h3>
<py-terminal auto></py-terminal>
</div>
<py-tutor>
<py-config>
plugins = [
"../build/plugins/python/py_tutor.py"
]
packages = ["pandas"]
</py-config>
<section class="pyscript">
<py-script>
import pandas as pd
from pyodide.http import open_url
import sys
title = "Pandas (and basic DOM manipulation)"
page_message = "This example loads a remote CSV file into a Pandas dataframe, displays it and lets you manipulate it through a Python REPL"
url = "https://raw.githubusercontent.com/datasets/airport-codes/master/data/airport-codes.csv"
Element("header-title").element.innerText = title
Element("page-title").element.innerText = title
Element("page-message").element.innerText = page_message
Element("txt-url").element.value = url
# Depending on the type of DOM element, there are several alternative methods to write to it
# Element("id-of-dom-element").write("example")
# Element("id-of-dom-element").innerText = "example"
# Element("id-of-dom-element").value = "example"
# Element("id-of-dom-element").element.innerText = "example"
# Element("id-of-dom-element").element.value = "example"
# js.document.getElementById("id-of-dom-element").innerText = "example"
# js.document.getElementById("id-of-dom-element").value = "example"
df = pd.DataFrame()
def loadFromURL(*ags, **kws):
global df
# clear dataframe & output
df = pd.DataFrame()
Element("pandas-output-inner").element.innerHTML = ""
url = Element("txt-url").element.value
log ("Trying to fetch CSV from " + url)
df = pd.read_csv(open_url(url))
Element("pandas-repl").element.style.display = "block"
Element("pandas-output").element.style.display = "block"
Element("pandas-dev-console").element.style.display = "block"
display (df, target="pandas-output-inner", append="False")
def log(message):
# log to pyscript dev console
print (message)
# log to JS console
js.console.log (message)
</py-script>
</section>
</py-tutor>
</body>
</html>

View File

@@ -33,7 +33,7 @@
</py-config>
<py-script src="./todo.py"> </py-script>
</py-tutor>
<main>
<section>