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> </a>
<p> <p>
Demo showing how a Simple <a href="https://developer.mozilla.org/en-US/docs/Web/API/WebGL_API" target="_blank">WebGL</a> 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> </p>
</div> </div>
</div> </div>

View File

@@ -43,21 +43,17 @@
classify the data. <br> classify the data. <br>
</p> </p>
<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 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> without issue. Ex: instead of <code>a &gt; b</code>, you will see <code>(a).__gt__(b)</code> instead. <br>
</p> </p>
<p> <py-script>import js; js.document.getElementById('python-status').innerHTML = 'Python is now ready. You may proceed.'</py-script>
<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>
<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>
</p> <py-script src="/micrograd_ai.py"></py-script>
<p> <div id="micrograd-run-all-print-div"></div><br>
<button id="run-all-button" class="btn btn-primary" type="submit" py-onClick="run_all_micrograd_demo()">Run All</button><br> <div id="micrograd-run-all-fig1-div"></div>
<py-script src="/micrograd_ai.py"></py-script> <div id="micrograd-run-all-fig2-div"></div><br>
<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>
</div> </div>
<py-repl auto-generate="false"> <py-repl auto-generate="false">
import random import random

View File

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

View File

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

View File

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