[dingus] Trying to get a web dingus working with pyodide
This commit is contained in:
parent
ccdda886ff
commit
20aebb5048
20 changed files with 14294 additions and 0 deletions
344
dingus/codemirror/codemirror.css
Normal file
344
dingus/codemirror/codemirror.css
Normal file
|
|
@ -0,0 +1,344 @@
|
||||||
|
/* BASICS */
|
||||||
|
|
||||||
|
.CodeMirror {
|
||||||
|
/* Set height, width, borders, and global font properties here */
|
||||||
|
font-family: monospace;
|
||||||
|
height: 300px;
|
||||||
|
color: black;
|
||||||
|
direction: ltr;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* PADDING */
|
||||||
|
|
||||||
|
.CodeMirror-lines {
|
||||||
|
padding: 4px 0; /* Vertical padding around content */
|
||||||
|
}
|
||||||
|
.CodeMirror pre.CodeMirror-line,
|
||||||
|
.CodeMirror pre.CodeMirror-line-like {
|
||||||
|
padding: 0 4px; /* Horizontal padding of content */
|
||||||
|
}
|
||||||
|
|
||||||
|
.CodeMirror-scrollbar-filler, .CodeMirror-gutter-filler {
|
||||||
|
background-color: white; /* The little square between H and V scrollbars */
|
||||||
|
}
|
||||||
|
|
||||||
|
/* GUTTER */
|
||||||
|
|
||||||
|
.CodeMirror-gutters {
|
||||||
|
border-right: 1px solid #ddd;
|
||||||
|
background-color: #f7f7f7;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
.CodeMirror-linenumbers {}
|
||||||
|
.CodeMirror-linenumber {
|
||||||
|
padding: 0 3px 0 5px;
|
||||||
|
min-width: 20px;
|
||||||
|
text-align: right;
|
||||||
|
color: #999;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.CodeMirror-guttermarker { color: black; }
|
||||||
|
.CodeMirror-guttermarker-subtle { color: #999; }
|
||||||
|
|
||||||
|
/* CURSOR */
|
||||||
|
|
||||||
|
.CodeMirror-cursor {
|
||||||
|
border-left: 1px solid black;
|
||||||
|
border-right: none;
|
||||||
|
width: 0;
|
||||||
|
}
|
||||||
|
/* Shown when moving in bi-directional text */
|
||||||
|
.CodeMirror div.CodeMirror-secondarycursor {
|
||||||
|
border-left: 1px solid silver;
|
||||||
|
}
|
||||||
|
.cm-fat-cursor .CodeMirror-cursor {
|
||||||
|
width: auto;
|
||||||
|
border: 0 !important;
|
||||||
|
background: #7e7;
|
||||||
|
}
|
||||||
|
.cm-fat-cursor div.CodeMirror-cursors {
|
||||||
|
z-index: 1;
|
||||||
|
}
|
||||||
|
.cm-fat-cursor .CodeMirror-line::selection,
|
||||||
|
.cm-fat-cursor .CodeMirror-line > span::selection,
|
||||||
|
.cm-fat-cursor .CodeMirror-line > span > span::selection { background: transparent; }
|
||||||
|
.cm-fat-cursor .CodeMirror-line::-moz-selection,
|
||||||
|
.cm-fat-cursor .CodeMirror-line > span::-moz-selection,
|
||||||
|
.cm-fat-cursor .CodeMirror-line > span > span::-moz-selection { background: transparent; }
|
||||||
|
.cm-fat-cursor { caret-color: transparent; }
|
||||||
|
@-moz-keyframes blink {
|
||||||
|
0% {}
|
||||||
|
50% { background-color: transparent; }
|
||||||
|
100% {}
|
||||||
|
}
|
||||||
|
@-webkit-keyframes blink {
|
||||||
|
0% {}
|
||||||
|
50% { background-color: transparent; }
|
||||||
|
100% {}
|
||||||
|
}
|
||||||
|
@keyframes blink {
|
||||||
|
0% {}
|
||||||
|
50% { background-color: transparent; }
|
||||||
|
100% {}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Can style cursor different in overwrite (non-insert) mode */
|
||||||
|
.CodeMirror-overwrite .CodeMirror-cursor {}
|
||||||
|
|
||||||
|
.cm-tab { display: inline-block; text-decoration: inherit; }
|
||||||
|
|
||||||
|
.CodeMirror-rulers {
|
||||||
|
position: absolute;
|
||||||
|
left: 0; right: 0; top: -50px; bottom: 0;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
.CodeMirror-ruler {
|
||||||
|
border-left: 1px solid #ccc;
|
||||||
|
top: 0; bottom: 0;
|
||||||
|
position: absolute;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* DEFAULT THEME */
|
||||||
|
|
||||||
|
.cm-s-default .cm-header {color: blue;}
|
||||||
|
.cm-s-default .cm-quote {color: #090;}
|
||||||
|
.cm-negative {color: #d44;}
|
||||||
|
.cm-positive {color: #292;}
|
||||||
|
.cm-header, .cm-strong {font-weight: bold;}
|
||||||
|
.cm-em {font-style: italic;}
|
||||||
|
.cm-link {text-decoration: underline;}
|
||||||
|
.cm-strikethrough {text-decoration: line-through;}
|
||||||
|
|
||||||
|
.cm-s-default .cm-keyword {color: #708;}
|
||||||
|
.cm-s-default .cm-atom {color: #219;}
|
||||||
|
.cm-s-default .cm-number {color: #164;}
|
||||||
|
.cm-s-default .cm-def {color: #00f;}
|
||||||
|
.cm-s-default .cm-variable,
|
||||||
|
.cm-s-default .cm-punctuation,
|
||||||
|
.cm-s-default .cm-property,
|
||||||
|
.cm-s-default .cm-operator {}
|
||||||
|
.cm-s-default .cm-variable-2 {color: #05a;}
|
||||||
|
.cm-s-default .cm-variable-3, .cm-s-default .cm-type {color: #085;}
|
||||||
|
.cm-s-default .cm-comment {color: #a50;}
|
||||||
|
.cm-s-default .cm-string {color: #a11;}
|
||||||
|
.cm-s-default .cm-string-2 {color: #f50;}
|
||||||
|
.cm-s-default .cm-meta {color: #555;}
|
||||||
|
.cm-s-default .cm-qualifier {color: #555;}
|
||||||
|
.cm-s-default .cm-builtin {color: #30a;}
|
||||||
|
.cm-s-default .cm-bracket {color: #997;}
|
||||||
|
.cm-s-default .cm-tag {color: #170;}
|
||||||
|
.cm-s-default .cm-attribute {color: #00c;}
|
||||||
|
.cm-s-default .cm-hr {color: #999;}
|
||||||
|
.cm-s-default .cm-link {color: #00c;}
|
||||||
|
|
||||||
|
.cm-s-default .cm-error {color: #f00;}
|
||||||
|
.cm-invalidchar {color: #f00;}
|
||||||
|
|
||||||
|
.CodeMirror-composing { border-bottom: 2px solid; }
|
||||||
|
|
||||||
|
/* Default styles for common addons */
|
||||||
|
|
||||||
|
div.CodeMirror span.CodeMirror-matchingbracket {color: #0b0;}
|
||||||
|
div.CodeMirror span.CodeMirror-nonmatchingbracket {color: #a22;}
|
||||||
|
.CodeMirror-matchingtag { background: rgba(255, 150, 0, .3); }
|
||||||
|
.CodeMirror-activeline-background {background: #e8f2ff;}
|
||||||
|
|
||||||
|
/* STOP */
|
||||||
|
|
||||||
|
/* The rest of this file contains styles related to the mechanics of
|
||||||
|
the editor. You probably shouldn't touch them. */
|
||||||
|
|
||||||
|
.CodeMirror {
|
||||||
|
position: relative;
|
||||||
|
overflow: hidden;
|
||||||
|
background: white;
|
||||||
|
}
|
||||||
|
|
||||||
|
.CodeMirror-scroll {
|
||||||
|
overflow: scroll !important; /* Things will break if this is overridden */
|
||||||
|
/* 50px is the magic margin used to hide the element's real scrollbars */
|
||||||
|
/* See overflow: hidden in .CodeMirror */
|
||||||
|
margin-bottom: -50px; margin-right: -50px;
|
||||||
|
padding-bottom: 50px;
|
||||||
|
height: 100%;
|
||||||
|
outline: none; /* Prevent dragging from highlighting the element */
|
||||||
|
position: relative;
|
||||||
|
z-index: 0;
|
||||||
|
}
|
||||||
|
.CodeMirror-sizer {
|
||||||
|
position: relative;
|
||||||
|
border-right: 50px solid transparent;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* The fake, visible scrollbars. Used to force redraw during scrolling
|
||||||
|
before actual scrolling happens, thus preventing shaking and
|
||||||
|
flickering artifacts. */
|
||||||
|
.CodeMirror-vscrollbar, .CodeMirror-hscrollbar, .CodeMirror-scrollbar-filler, .CodeMirror-gutter-filler {
|
||||||
|
position: absolute;
|
||||||
|
z-index: 6;
|
||||||
|
display: none;
|
||||||
|
outline: none;
|
||||||
|
}
|
||||||
|
.CodeMirror-vscrollbar {
|
||||||
|
right: 0; top: 0;
|
||||||
|
overflow-x: hidden;
|
||||||
|
overflow-y: scroll;
|
||||||
|
}
|
||||||
|
.CodeMirror-hscrollbar {
|
||||||
|
bottom: 0; left: 0;
|
||||||
|
overflow-y: hidden;
|
||||||
|
overflow-x: scroll;
|
||||||
|
}
|
||||||
|
.CodeMirror-scrollbar-filler {
|
||||||
|
right: 0; bottom: 0;
|
||||||
|
}
|
||||||
|
.CodeMirror-gutter-filler {
|
||||||
|
left: 0; bottom: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.CodeMirror-gutters {
|
||||||
|
position: absolute; left: 0; top: 0;
|
||||||
|
min-height: 100%;
|
||||||
|
z-index: 3;
|
||||||
|
}
|
||||||
|
.CodeMirror-gutter {
|
||||||
|
white-space: normal;
|
||||||
|
height: 100%;
|
||||||
|
display: inline-block;
|
||||||
|
vertical-align: top;
|
||||||
|
margin-bottom: -50px;
|
||||||
|
}
|
||||||
|
.CodeMirror-gutter-wrapper {
|
||||||
|
position: absolute;
|
||||||
|
z-index: 4;
|
||||||
|
background: none !important;
|
||||||
|
border: none !important;
|
||||||
|
}
|
||||||
|
.CodeMirror-gutter-background {
|
||||||
|
position: absolute;
|
||||||
|
top: 0; bottom: 0;
|
||||||
|
z-index: 4;
|
||||||
|
}
|
||||||
|
.CodeMirror-gutter-elt {
|
||||||
|
position: absolute;
|
||||||
|
cursor: default;
|
||||||
|
z-index: 4;
|
||||||
|
}
|
||||||
|
.CodeMirror-gutter-wrapper ::selection { background-color: transparent }
|
||||||
|
.CodeMirror-gutter-wrapper ::-moz-selection { background-color: transparent }
|
||||||
|
|
||||||
|
.CodeMirror-lines {
|
||||||
|
cursor: text;
|
||||||
|
min-height: 1px; /* prevents collapsing before first draw */
|
||||||
|
}
|
||||||
|
.CodeMirror pre.CodeMirror-line,
|
||||||
|
.CodeMirror pre.CodeMirror-line-like {
|
||||||
|
/* Reset some styles that the rest of the page might have set */
|
||||||
|
-moz-border-radius: 0; -webkit-border-radius: 0; border-radius: 0;
|
||||||
|
border-width: 0;
|
||||||
|
background: transparent;
|
||||||
|
font-family: inherit;
|
||||||
|
font-size: inherit;
|
||||||
|
margin: 0;
|
||||||
|
white-space: pre;
|
||||||
|
word-wrap: normal;
|
||||||
|
line-height: inherit;
|
||||||
|
color: inherit;
|
||||||
|
z-index: 2;
|
||||||
|
position: relative;
|
||||||
|
overflow: visible;
|
||||||
|
-webkit-tap-highlight-color: transparent;
|
||||||
|
-webkit-font-variant-ligatures: contextual;
|
||||||
|
font-variant-ligatures: contextual;
|
||||||
|
}
|
||||||
|
.CodeMirror-wrap pre.CodeMirror-line,
|
||||||
|
.CodeMirror-wrap pre.CodeMirror-line-like {
|
||||||
|
word-wrap: break-word;
|
||||||
|
white-space: pre-wrap;
|
||||||
|
word-break: normal;
|
||||||
|
}
|
||||||
|
|
||||||
|
.CodeMirror-linebackground {
|
||||||
|
position: absolute;
|
||||||
|
left: 0; right: 0; top: 0; bottom: 0;
|
||||||
|
z-index: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.CodeMirror-linewidget {
|
||||||
|
position: relative;
|
||||||
|
z-index: 2;
|
||||||
|
padding: 0.1px; /* Force widget margins to stay inside of the container */
|
||||||
|
}
|
||||||
|
|
||||||
|
.CodeMirror-widget {}
|
||||||
|
|
||||||
|
.CodeMirror-rtl pre { direction: rtl; }
|
||||||
|
|
||||||
|
.CodeMirror-code {
|
||||||
|
outline: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Force content-box sizing for the elements where we expect it */
|
||||||
|
.CodeMirror-scroll,
|
||||||
|
.CodeMirror-sizer,
|
||||||
|
.CodeMirror-gutter,
|
||||||
|
.CodeMirror-gutters,
|
||||||
|
.CodeMirror-linenumber {
|
||||||
|
-moz-box-sizing: content-box;
|
||||||
|
box-sizing: content-box;
|
||||||
|
}
|
||||||
|
|
||||||
|
.CodeMirror-measure {
|
||||||
|
position: absolute;
|
||||||
|
width: 100%;
|
||||||
|
height: 0;
|
||||||
|
overflow: hidden;
|
||||||
|
visibility: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
.CodeMirror-cursor {
|
||||||
|
position: absolute;
|
||||||
|
pointer-events: none;
|
||||||
|
}
|
||||||
|
.CodeMirror-measure pre { position: static; }
|
||||||
|
|
||||||
|
div.CodeMirror-cursors {
|
||||||
|
visibility: hidden;
|
||||||
|
position: relative;
|
||||||
|
z-index: 3;
|
||||||
|
}
|
||||||
|
div.CodeMirror-dragcursors {
|
||||||
|
visibility: visible;
|
||||||
|
}
|
||||||
|
|
||||||
|
.CodeMirror-focused div.CodeMirror-cursors {
|
||||||
|
visibility: visible;
|
||||||
|
}
|
||||||
|
|
||||||
|
.CodeMirror-selected { background: #d9d9d9; }
|
||||||
|
.CodeMirror-focused .CodeMirror-selected { background: #d7d4f0; }
|
||||||
|
.CodeMirror-crosshair { cursor: crosshair; }
|
||||||
|
.CodeMirror-line::selection, .CodeMirror-line > span::selection, .CodeMirror-line > span > span::selection { background: #d7d4f0; }
|
||||||
|
.CodeMirror-line::-moz-selection, .CodeMirror-line > span::-moz-selection, .CodeMirror-line > span > span::-moz-selection { background: #d7d4f0; }
|
||||||
|
|
||||||
|
.cm-searching {
|
||||||
|
background-color: #ffa;
|
||||||
|
background-color: rgba(255, 255, 0, .4);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Used to force a border model for a node */
|
||||||
|
.cm-force-border { padding-right: .1px; }
|
||||||
|
|
||||||
|
@media print {
|
||||||
|
/* Hide the cursor when printing */
|
||||||
|
.CodeMirror div.CodeMirror-cursors {
|
||||||
|
visibility: hidden;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* See issue #2901 */
|
||||||
|
.cm-tab-wrap-hack:after { content: ''; }
|
||||||
|
|
||||||
|
/* Help users use markselection to safely style text background */
|
||||||
|
span.CodeMirror-selectedtext { background: none; }
|
||||||
9884
dingus/codemirror/codemirror.js
Normal file
9884
dingus/codemirror/codemirror.js
Normal file
File diff suppressed because it is too large
Load diff
402
dingus/codemirror/python.js
Normal file
402
dingus/codemirror/python.js
Normal file
|
|
@ -0,0 +1,402 @@
|
||||||
|
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
||||||
|
// Distributed under an MIT license: https://codemirror.net/5/LICENSE
|
||||||
|
|
||||||
|
(function(mod) {
|
||||||
|
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
||||||
|
mod(require("../../lib/codemirror"));
|
||||||
|
else if (typeof define == "function" && define.amd) // AMD
|
||||||
|
define(["../../lib/codemirror"], mod);
|
||||||
|
else // Plain browser env
|
||||||
|
mod(CodeMirror);
|
||||||
|
})(function(CodeMirror) {
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
function wordRegexp(words) {
|
||||||
|
return new RegExp("^((" + words.join(")|(") + "))\\b");
|
||||||
|
}
|
||||||
|
|
||||||
|
var wordOperators = wordRegexp(["and", "or", "not", "is"]);
|
||||||
|
var commonKeywords = ["as", "assert", "break", "class", "continue",
|
||||||
|
"def", "del", "elif", "else", "except", "finally",
|
||||||
|
"for", "from", "global", "if", "import",
|
||||||
|
"lambda", "pass", "raise", "return",
|
||||||
|
"try", "while", "with", "yield", "in", "False", "True"];
|
||||||
|
var commonBuiltins = ["abs", "all", "any", "bin", "bool", "bytearray", "callable", "chr",
|
||||||
|
"classmethod", "compile", "complex", "delattr", "dict", "dir", "divmod",
|
||||||
|
"enumerate", "eval", "filter", "float", "format", "frozenset",
|
||||||
|
"getattr", "globals", "hasattr", "hash", "help", "hex", "id",
|
||||||
|
"input", "int", "isinstance", "issubclass", "iter", "len",
|
||||||
|
"list", "locals", "map", "max", "memoryview", "min", "next",
|
||||||
|
"object", "oct", "open", "ord", "pow", "property", "range",
|
||||||
|
"repr", "reversed", "round", "set", "setattr", "slice",
|
||||||
|
"sorted", "staticmethod", "str", "sum", "super", "tuple",
|
||||||
|
"type", "vars", "zip", "__import__", "NotImplemented",
|
||||||
|
"Ellipsis", "__debug__"];
|
||||||
|
CodeMirror.registerHelper("hintWords", "python", commonKeywords.concat(commonBuiltins).concat(["exec", "print"]));
|
||||||
|
|
||||||
|
function top(state) {
|
||||||
|
return state.scopes[state.scopes.length - 1];
|
||||||
|
}
|
||||||
|
|
||||||
|
CodeMirror.defineMode("python", function(conf, parserConf) {
|
||||||
|
var ERRORCLASS = "error";
|
||||||
|
|
||||||
|
var delimiters = parserConf.delimiters || parserConf.singleDelimiters || /^[\(\)\[\]\{\}@,:`=;\.\\]/;
|
||||||
|
// (Backwards-compatibility with old, cumbersome config system)
|
||||||
|
var operators = [parserConf.singleOperators, parserConf.doubleOperators, parserConf.doubleDelimiters, parserConf.tripleDelimiters,
|
||||||
|
parserConf.operators || /^([-+*/%\/&|^]=?|[<>=]+|\/\/=?|\*\*=?|!=|[~!@]|\.\.\.)/]
|
||||||
|
for (var i = 0; i < operators.length; i++) if (!operators[i]) operators.splice(i--, 1)
|
||||||
|
|
||||||
|
var hangingIndent = parserConf.hangingIndent || conf.indentUnit;
|
||||||
|
|
||||||
|
var myKeywords = commonKeywords, myBuiltins = commonBuiltins;
|
||||||
|
if (parserConf.extra_keywords != undefined)
|
||||||
|
myKeywords = myKeywords.concat(parserConf.extra_keywords);
|
||||||
|
|
||||||
|
if (parserConf.extra_builtins != undefined)
|
||||||
|
myBuiltins = myBuiltins.concat(parserConf.extra_builtins);
|
||||||
|
|
||||||
|
var py3 = !(parserConf.version && Number(parserConf.version) < 3)
|
||||||
|
if (py3) {
|
||||||
|
// since http://legacy.python.org/dev/peps/pep-0465/ @ is also an operator
|
||||||
|
var identifiers = parserConf.identifiers|| /^[_A-Za-z\u00A1-\uFFFF][_A-Za-z0-9\u00A1-\uFFFF]*/;
|
||||||
|
myKeywords = myKeywords.concat(["nonlocal", "None", "aiter", "anext", "async", "await", "breakpoint", "match", "case"]);
|
||||||
|
myBuiltins = myBuiltins.concat(["ascii", "bytes", "exec", "print"]);
|
||||||
|
var stringPrefixes = new RegExp("^(([rbuf]|(br)|(rb)|(fr)|(rf))?('{3}|\"{3}|['\"]))", "i");
|
||||||
|
} else {
|
||||||
|
var identifiers = parserConf.identifiers|| /^[_A-Za-z][_A-Za-z0-9]*/;
|
||||||
|
myKeywords = myKeywords.concat(["exec", "print"]);
|
||||||
|
myBuiltins = myBuiltins.concat(["apply", "basestring", "buffer", "cmp", "coerce", "execfile",
|
||||||
|
"file", "intern", "long", "raw_input", "reduce", "reload",
|
||||||
|
"unichr", "unicode", "xrange", "None"]);
|
||||||
|
var stringPrefixes = new RegExp("^(([rubf]|(ur)|(br))?('{3}|\"{3}|['\"]))", "i");
|
||||||
|
}
|
||||||
|
var keywords = wordRegexp(myKeywords);
|
||||||
|
var builtins = wordRegexp(myBuiltins);
|
||||||
|
|
||||||
|
// tokenizers
|
||||||
|
function tokenBase(stream, state) {
|
||||||
|
var sol = stream.sol() && state.lastToken != "\\"
|
||||||
|
if (sol) state.indent = stream.indentation()
|
||||||
|
// Handle scope changes
|
||||||
|
if (sol && top(state).type == "py") {
|
||||||
|
var scopeOffset = top(state).offset;
|
||||||
|
if (stream.eatSpace()) {
|
||||||
|
var lineOffset = stream.indentation();
|
||||||
|
if (lineOffset > scopeOffset)
|
||||||
|
pushPyScope(state);
|
||||||
|
else if (lineOffset < scopeOffset && dedent(stream, state) && stream.peek() != "#")
|
||||||
|
state.errorToken = true;
|
||||||
|
return null;
|
||||||
|
} else {
|
||||||
|
var style = tokenBaseInner(stream, state);
|
||||||
|
if (scopeOffset > 0 && dedent(stream, state))
|
||||||
|
style += " " + ERRORCLASS;
|
||||||
|
return style;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return tokenBaseInner(stream, state);
|
||||||
|
}
|
||||||
|
|
||||||
|
function tokenBaseInner(stream, state, inFormat) {
|
||||||
|
if (stream.eatSpace()) return null;
|
||||||
|
|
||||||
|
// Handle Comments
|
||||||
|
if (!inFormat && stream.match(/^#.*/)) return "comment";
|
||||||
|
|
||||||
|
// Handle Number Literals
|
||||||
|
if (stream.match(/^[0-9\.]/, false)) {
|
||||||
|
var floatLiteral = false;
|
||||||
|
// Floats
|
||||||
|
if (stream.match(/^[\d_]*\.\d+(e[\+\-]?\d+)?/i)) { floatLiteral = true; }
|
||||||
|
if (stream.match(/^[\d_]+\.\d*/)) { floatLiteral = true; }
|
||||||
|
if (stream.match(/^\.\d+/)) { floatLiteral = true; }
|
||||||
|
if (floatLiteral) {
|
||||||
|
// Float literals may be "imaginary"
|
||||||
|
stream.eat(/J/i);
|
||||||
|
return "number";
|
||||||
|
}
|
||||||
|
// Integers
|
||||||
|
var intLiteral = false;
|
||||||
|
// Hex
|
||||||
|
if (stream.match(/^0x[0-9a-f_]+/i)) intLiteral = true;
|
||||||
|
// Binary
|
||||||
|
if (stream.match(/^0b[01_]+/i)) intLiteral = true;
|
||||||
|
// Octal
|
||||||
|
if (stream.match(/^0o[0-7_]+/i)) intLiteral = true;
|
||||||
|
// Decimal
|
||||||
|
if (stream.match(/^[1-9][\d_]*(e[\+\-]?[\d_]+)?/)) {
|
||||||
|
// Decimal literals may be "imaginary"
|
||||||
|
stream.eat(/J/i);
|
||||||
|
// TODO - Can you have imaginary longs?
|
||||||
|
intLiteral = true;
|
||||||
|
}
|
||||||
|
// Zero by itself with no other piece of number.
|
||||||
|
if (stream.match(/^0(?![\dx])/i)) intLiteral = true;
|
||||||
|
if (intLiteral) {
|
||||||
|
// Integer literals may be "long"
|
||||||
|
stream.eat(/L/i);
|
||||||
|
return "number";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Handle Strings
|
||||||
|
if (stream.match(stringPrefixes)) {
|
||||||
|
var isFmtString = stream.current().toLowerCase().indexOf('f') !== -1;
|
||||||
|
if (!isFmtString) {
|
||||||
|
state.tokenize = tokenStringFactory(stream.current(), state.tokenize);
|
||||||
|
return state.tokenize(stream, state);
|
||||||
|
} else {
|
||||||
|
state.tokenize = formatStringFactory(stream.current(), state.tokenize);
|
||||||
|
return state.tokenize(stream, state);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (var i = 0; i < operators.length; i++)
|
||||||
|
if (stream.match(operators[i])) return "operator"
|
||||||
|
|
||||||
|
if (stream.match(delimiters)) return "punctuation";
|
||||||
|
|
||||||
|
if (state.lastToken == "." && stream.match(identifiers))
|
||||||
|
return "property";
|
||||||
|
|
||||||
|
if (stream.match(keywords) || stream.match(wordOperators))
|
||||||
|
return "keyword";
|
||||||
|
|
||||||
|
if (stream.match(builtins))
|
||||||
|
return "builtin";
|
||||||
|
|
||||||
|
if (stream.match(/^(self|cls)\b/))
|
||||||
|
return "variable-2";
|
||||||
|
|
||||||
|
if (stream.match(identifiers)) {
|
||||||
|
if (state.lastToken == "def" || state.lastToken == "class")
|
||||||
|
return "def";
|
||||||
|
return "variable";
|
||||||
|
}
|
||||||
|
|
||||||
|
// Handle non-detected items
|
||||||
|
stream.next();
|
||||||
|
return inFormat ? null :ERRORCLASS;
|
||||||
|
}
|
||||||
|
|
||||||
|
function formatStringFactory(delimiter, tokenOuter) {
|
||||||
|
while ("rubf".indexOf(delimiter.charAt(0).toLowerCase()) >= 0)
|
||||||
|
delimiter = delimiter.substr(1);
|
||||||
|
|
||||||
|
var singleline = delimiter.length == 1;
|
||||||
|
var OUTCLASS = "string";
|
||||||
|
|
||||||
|
function tokenNestedExpr(depth) {
|
||||||
|
return function(stream, state) {
|
||||||
|
var inner = tokenBaseInner(stream, state, true)
|
||||||
|
if (inner == "punctuation") {
|
||||||
|
if (stream.current() == "{") {
|
||||||
|
state.tokenize = tokenNestedExpr(depth + 1)
|
||||||
|
} else if (stream.current() == "}") {
|
||||||
|
if (depth > 1) state.tokenize = tokenNestedExpr(depth - 1)
|
||||||
|
else state.tokenize = tokenString
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return inner
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function tokenString(stream, state) {
|
||||||
|
while (!stream.eol()) {
|
||||||
|
stream.eatWhile(/[^'"\{\}\\]/);
|
||||||
|
if (stream.eat("\\")) {
|
||||||
|
stream.next();
|
||||||
|
if (singleline && stream.eol())
|
||||||
|
return OUTCLASS;
|
||||||
|
} else if (stream.match(delimiter)) {
|
||||||
|
state.tokenize = tokenOuter;
|
||||||
|
return OUTCLASS;
|
||||||
|
} else if (stream.match('{{')) {
|
||||||
|
// ignore {{ in f-str
|
||||||
|
return OUTCLASS;
|
||||||
|
} else if (stream.match('{', false)) {
|
||||||
|
// switch to nested mode
|
||||||
|
state.tokenize = tokenNestedExpr(0)
|
||||||
|
if (stream.current()) return OUTCLASS;
|
||||||
|
else return state.tokenize(stream, state)
|
||||||
|
} else if (stream.match('}}')) {
|
||||||
|
return OUTCLASS;
|
||||||
|
} else if (stream.match('}')) {
|
||||||
|
// single } in f-string is an error
|
||||||
|
return ERRORCLASS;
|
||||||
|
} else {
|
||||||
|
stream.eat(/['"]/);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (singleline) {
|
||||||
|
if (parserConf.singleLineStringErrors)
|
||||||
|
return ERRORCLASS;
|
||||||
|
else
|
||||||
|
state.tokenize = tokenOuter;
|
||||||
|
}
|
||||||
|
return OUTCLASS;
|
||||||
|
}
|
||||||
|
tokenString.isString = true;
|
||||||
|
return tokenString;
|
||||||
|
}
|
||||||
|
|
||||||
|
function tokenStringFactory(delimiter, tokenOuter) {
|
||||||
|
while ("rubf".indexOf(delimiter.charAt(0).toLowerCase()) >= 0)
|
||||||
|
delimiter = delimiter.substr(1);
|
||||||
|
|
||||||
|
var singleline = delimiter.length == 1;
|
||||||
|
var OUTCLASS = "string";
|
||||||
|
|
||||||
|
function tokenString(stream, state) {
|
||||||
|
while (!stream.eol()) {
|
||||||
|
stream.eatWhile(/[^'"\\]/);
|
||||||
|
if (stream.eat("\\")) {
|
||||||
|
stream.next();
|
||||||
|
if (singleline && stream.eol())
|
||||||
|
return OUTCLASS;
|
||||||
|
} else if (stream.match(delimiter)) {
|
||||||
|
state.tokenize = tokenOuter;
|
||||||
|
return OUTCLASS;
|
||||||
|
} else {
|
||||||
|
stream.eat(/['"]/);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (singleline) {
|
||||||
|
if (parserConf.singleLineStringErrors)
|
||||||
|
return ERRORCLASS;
|
||||||
|
else
|
||||||
|
state.tokenize = tokenOuter;
|
||||||
|
}
|
||||||
|
return OUTCLASS;
|
||||||
|
}
|
||||||
|
tokenString.isString = true;
|
||||||
|
return tokenString;
|
||||||
|
}
|
||||||
|
|
||||||
|
function pushPyScope(state) {
|
||||||
|
while (top(state).type != "py") state.scopes.pop()
|
||||||
|
state.scopes.push({offset: top(state).offset + conf.indentUnit,
|
||||||
|
type: "py",
|
||||||
|
align: null})
|
||||||
|
}
|
||||||
|
|
||||||
|
function pushBracketScope(stream, state, type) {
|
||||||
|
var align = stream.match(/^[\s\[\{\(]*(?:#|$)/, false) ? null : stream.column() + 1
|
||||||
|
state.scopes.push({offset: state.indent + hangingIndent,
|
||||||
|
type: type,
|
||||||
|
align: align})
|
||||||
|
}
|
||||||
|
|
||||||
|
function dedent(stream, state) {
|
||||||
|
var indented = stream.indentation();
|
||||||
|
while (state.scopes.length > 1 && top(state).offset > indented) {
|
||||||
|
if (top(state).type != "py") return true;
|
||||||
|
state.scopes.pop();
|
||||||
|
}
|
||||||
|
return top(state).offset != indented;
|
||||||
|
}
|
||||||
|
|
||||||
|
function tokenLexer(stream, state) {
|
||||||
|
if (stream.sol()) {
|
||||||
|
state.beginningOfLine = true;
|
||||||
|
state.dedent = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
var style = state.tokenize(stream, state);
|
||||||
|
var current = stream.current();
|
||||||
|
|
||||||
|
// Handle decorators
|
||||||
|
if (state.beginningOfLine && current == "@")
|
||||||
|
return stream.match(identifiers, false) ? "meta" : py3 ? "operator" : ERRORCLASS;
|
||||||
|
|
||||||
|
if (/\S/.test(current)) state.beginningOfLine = false;
|
||||||
|
|
||||||
|
if ((style == "variable" || style == "builtin")
|
||||||
|
&& state.lastToken == "meta")
|
||||||
|
style = "meta";
|
||||||
|
|
||||||
|
// Handle scope changes.
|
||||||
|
if (current == "pass" || current == "return")
|
||||||
|
state.dedent = true;
|
||||||
|
|
||||||
|
if (current == "lambda") state.lambda = true;
|
||||||
|
if (current == ":" && !state.lambda && top(state).type == "py" && stream.match(/^\s*(?:#|$)/, false))
|
||||||
|
pushPyScope(state);
|
||||||
|
|
||||||
|
if (current.length == 1 && !/string|comment/.test(style)) {
|
||||||
|
var delimiter_index = "[({".indexOf(current);
|
||||||
|
if (delimiter_index != -1)
|
||||||
|
pushBracketScope(stream, state, "])}".slice(delimiter_index, delimiter_index+1));
|
||||||
|
|
||||||
|
delimiter_index = "])}".indexOf(current);
|
||||||
|
if (delimiter_index != -1) {
|
||||||
|
if (top(state).type == current) state.indent = state.scopes.pop().offset - hangingIndent
|
||||||
|
else return ERRORCLASS;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (state.dedent && stream.eol() && top(state).type == "py" && state.scopes.length > 1)
|
||||||
|
state.scopes.pop();
|
||||||
|
|
||||||
|
return style;
|
||||||
|
}
|
||||||
|
|
||||||
|
var external = {
|
||||||
|
startState: function(basecolumn) {
|
||||||
|
return {
|
||||||
|
tokenize: tokenBase,
|
||||||
|
scopes: [{offset: basecolumn || 0, type: "py", align: null}],
|
||||||
|
indent: basecolumn || 0,
|
||||||
|
lastToken: null,
|
||||||
|
lambda: false,
|
||||||
|
dedent: 0
|
||||||
|
};
|
||||||
|
},
|
||||||
|
|
||||||
|
token: function(stream, state) {
|
||||||
|
var addErr = state.errorToken;
|
||||||
|
if (addErr) state.errorToken = false;
|
||||||
|
var style = tokenLexer(stream, state);
|
||||||
|
|
||||||
|
if (style && style != "comment")
|
||||||
|
state.lastToken = (style == "keyword" || style == "punctuation") ? stream.current() : style;
|
||||||
|
if (style == "punctuation") style = null;
|
||||||
|
|
||||||
|
if (stream.eol() && state.lambda)
|
||||||
|
state.lambda = false;
|
||||||
|
return addErr ? style + " " + ERRORCLASS : style;
|
||||||
|
},
|
||||||
|
|
||||||
|
indent: function(state, textAfter) {
|
||||||
|
if (state.tokenize != tokenBase)
|
||||||
|
return state.tokenize.isString ? CodeMirror.Pass : 0;
|
||||||
|
|
||||||
|
var scope = top(state)
|
||||||
|
var closing = scope.type == textAfter.charAt(0) ||
|
||||||
|
scope.type == "py" && !state.dedent && /^(else:|elif |except |finally:)/.test(textAfter)
|
||||||
|
if (scope.align != null)
|
||||||
|
return scope.align - (closing ? 1 : 0)
|
||||||
|
else
|
||||||
|
return scope.offset - (closing ? hangingIndent : 0)
|
||||||
|
},
|
||||||
|
|
||||||
|
electricInput: /^\s*([\}\]\)]|else:|elif |except |finally:)$/,
|
||||||
|
closeBrackets: {triples: "'\""},
|
||||||
|
lineComment: "#",
|
||||||
|
fold: "indent"
|
||||||
|
};
|
||||||
|
return external;
|
||||||
|
});
|
||||||
|
|
||||||
|
CodeMirror.defineMIME("text/x-python", "python");
|
||||||
|
|
||||||
|
var words = function(str) { return str.split(" "); };
|
||||||
|
|
||||||
|
CodeMirror.defineMIME("text/x-cython", {
|
||||||
|
name: "python",
|
||||||
|
extra_keywords: words("by cdef cimport cpdef ctypedef enum except "+
|
||||||
|
"extern gil include nogil property public "+
|
||||||
|
"readonly struct union DEF IF ELIF ELSE")
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
33
dingus/dingus.html
Normal file
33
dingus/dingus.html
Normal file
|
|
@ -0,0 +1,33 @@
|
||||||
|
<!doctype html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>Dingus</title>
|
||||||
|
<script src="https://cdn.jsdelivr.net/pyodide/v0.26.2/full/pyodide.js"></script>
|
||||||
|
|
||||||
|
<!-- CodeMirror -->
|
||||||
|
<link rel="stylesheet" href="./codemirror/codemirror.css" />
|
||||||
|
<script src="./codemirror/codemirror.js"></script>
|
||||||
|
<script src="./codemirror/python.js"></script>
|
||||||
|
|
||||||
|
<link rel="stylesheet" href="./style.css" />
|
||||||
|
<style>
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div class="page-container">
|
||||||
|
<div class="grammar-container">
|
||||||
|
<textarea id="grammar" name="grammar" class="main-textarea"></textarea>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="input-container">
|
||||||
|
<textarea id="input" name="input" class="main-textarea"></textarea>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="results-container">
|
||||||
|
<textarea readonly id="output" name="output" class="main-textarea"></textarea>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script src="./dingus.js"></script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
60
dingus/dingus.js
Normal file
60
dingus/dingus.js
Normal file
|
|
@ -0,0 +1,60 @@
|
||||||
|
let pending_grammar = null;
|
||||||
|
let next_grammar = null;
|
||||||
|
|
||||||
|
function submit_grammar(code) {
|
||||||
|
if (pending_grammar) {
|
||||||
|
console.log("Grammar still pending, parking it");
|
||||||
|
next_grammar = code;
|
||||||
|
} else {
|
||||||
|
pending_grammar = code;
|
||||||
|
worker.postMessage({kind: "grammar_module", data: code});
|
||||||
|
console.log("Grammar posted");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const worker = new Worker('worker.js');
|
||||||
|
worker.onmessage = (e) => {
|
||||||
|
const message = e.data;
|
||||||
|
if (message.kind === "grammar_status") {
|
||||||
|
if ((message.status === "ok") || (message.status === "error")) {
|
||||||
|
pending_grammar = null;
|
||||||
|
if (next_grammar) {
|
||||||
|
pending_grammar = next_grammar;
|
||||||
|
next_grammar = null;
|
||||||
|
|
||||||
|
worker.postMessage({kind: "grammar_module", data: pending_grammar});
|
||||||
|
console.log("Posted another grammar");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
function setup_editors() {
|
||||||
|
const grammar_editor = CodeMirror.fromTextArea(
|
||||||
|
document.getElementById("grammar"),
|
||||||
|
{
|
||||||
|
lineNumbers: true,
|
||||||
|
mode: "python",
|
||||||
|
value: "from parser import Grammar\n\nclass MyGrammar(Grammar):\n pass\n",
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
|
let change_timer_id = null;
|
||||||
|
grammar_editor.doc.on("change", () => {
|
||||||
|
clearTimeout(change_timer_id);
|
||||||
|
change_timer_id = setTimeout(() => {
|
||||||
|
change_timer_id = null;
|
||||||
|
submit_grammar(grammar_editor.doc.getValue());
|
||||||
|
}, 100);
|
||||||
|
});
|
||||||
|
|
||||||
|
const input_editor = CodeMirror.fromTextArea(
|
||||||
|
document.getElementById("input"),
|
||||||
|
{
|
||||||
|
lineNumbers: true,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
setup_editors();
|
||||||
1115
dingus/pyodide/ffi.d.ts
vendored
Normal file
1115
dingus/pyodide/ffi.d.ts
vendored
Normal file
File diff suppressed because it is too large
Load diff
421
dingus/pyodide/micropip-0.6.0-py3-none-any.whl.metadata
Normal file
421
dingus/pyodide/micropip-0.6.0-py3-none-any.whl.metadata
Normal file
|
|
@ -0,0 +1,421 @@
|
||||||
|
Metadata-Version: 2.1
|
||||||
|
Name: micropip
|
||||||
|
Version: 0.6.0
|
||||||
|
Summary: A lightweight Python package installer for the web
|
||||||
|
Author: Pyodide developers
|
||||||
|
License: Mozilla Public License Version 2.0
|
||||||
|
==================================
|
||||||
|
|
||||||
|
1. Definitions
|
||||||
|
--------------
|
||||||
|
|
||||||
|
1.1. "Contributor"
|
||||||
|
means each individual or legal entity that creates, contributes to
|
||||||
|
the creation of, or owns Covered Software.
|
||||||
|
|
||||||
|
1.2. "Contributor Version"
|
||||||
|
means the combination of the Contributions of others (if any) used
|
||||||
|
by a Contributor and that particular Contributor's Contribution.
|
||||||
|
|
||||||
|
1.3. "Contribution"
|
||||||
|
means Covered Software of a particular Contributor.
|
||||||
|
|
||||||
|
1.4. "Covered Software"
|
||||||
|
means Source Code Form to which the initial Contributor has attached
|
||||||
|
the notice in Exhibit A, the Executable Form of such Source Code
|
||||||
|
Form, and Modifications of such Source Code Form, in each case
|
||||||
|
including portions thereof.
|
||||||
|
|
||||||
|
1.5. "Incompatible With Secondary Licenses"
|
||||||
|
means
|
||||||
|
|
||||||
|
(a) that the initial Contributor has attached the notice described
|
||||||
|
in Exhibit B to the Covered Software; or
|
||||||
|
|
||||||
|
(b) that the Covered Software was made available under the terms of
|
||||||
|
version 1.1 or earlier of the License, but not also under the
|
||||||
|
terms of a Secondary License.
|
||||||
|
|
||||||
|
1.6. "Executable Form"
|
||||||
|
means any form of the work other than Source Code Form.
|
||||||
|
|
||||||
|
1.7. "Larger Work"
|
||||||
|
means a work that combines Covered Software with other material, in
|
||||||
|
a separate file or files, that is not Covered Software.
|
||||||
|
|
||||||
|
1.8. "License"
|
||||||
|
means this document.
|
||||||
|
|
||||||
|
1.9. "Licensable"
|
||||||
|
means having the right to grant, to the maximum extent possible,
|
||||||
|
whether at the time of the initial grant or subsequently, any and
|
||||||
|
all of the rights conveyed by this License.
|
||||||
|
|
||||||
|
1.10. "Modifications"
|
||||||
|
means any of the following:
|
||||||
|
|
||||||
|
(a) any file in Source Code Form that results from an addition to,
|
||||||
|
deletion from, or modification of the contents of Covered
|
||||||
|
Software; or
|
||||||
|
|
||||||
|
(b) any new file in Source Code Form that contains any Covered
|
||||||
|
Software.
|
||||||
|
|
||||||
|
1.11. "Patent Claims" of a Contributor
|
||||||
|
means any patent claim(s), including without limitation, method,
|
||||||
|
process, and apparatus claims, in any patent Licensable by such
|
||||||
|
Contributor that would be infringed, but for the grant of the
|
||||||
|
License, by the making, using, selling, offering for sale, having
|
||||||
|
made, import, or transfer of either its Contributions or its
|
||||||
|
Contributor Version.
|
||||||
|
|
||||||
|
1.12. "Secondary License"
|
||||||
|
means either the GNU General Public License, Version 2.0, the GNU
|
||||||
|
Lesser General Public License, Version 2.1, the GNU Affero General
|
||||||
|
Public License, Version 3.0, or any later versions of those
|
||||||
|
licenses.
|
||||||
|
|
||||||
|
1.13. "Source Code Form"
|
||||||
|
means the form of the work preferred for making modifications.
|
||||||
|
|
||||||
|
1.14. "You" (or "Your")
|
||||||
|
means an individual or a legal entity exercising rights under this
|
||||||
|
License. For legal entities, "You" includes any entity that
|
||||||
|
controls, is controlled by, or is under common control with You. For
|
||||||
|
purposes of this definition, "control" means (a) the power, direct
|
||||||
|
or indirect, to cause the direction or management of such entity,
|
||||||
|
whether by contract or otherwise, or (b) ownership of more than
|
||||||
|
fifty percent (50%) of the outstanding shares or beneficial
|
||||||
|
ownership of such entity.
|
||||||
|
|
||||||
|
2. License Grants and Conditions
|
||||||
|
--------------------------------
|
||||||
|
|
||||||
|
2.1. Grants
|
||||||
|
|
||||||
|
Each Contributor hereby grants You a world-wide, royalty-free,
|
||||||
|
non-exclusive license:
|
||||||
|
|
||||||
|
(a) under intellectual property rights (other than patent or trademark)
|
||||||
|
Licensable by such Contributor to use, reproduce, make available,
|
||||||
|
modify, display, perform, distribute, and otherwise exploit its
|
||||||
|
Contributions, either on an unmodified basis, with Modifications, or
|
||||||
|
as part of a Larger Work; and
|
||||||
|
|
||||||
|
(b) under Patent Claims of such Contributor to make, use, sell, offer
|
||||||
|
for sale, have made, import, and otherwise transfer either its
|
||||||
|
Contributions or its Contributor Version.
|
||||||
|
|
||||||
|
2.2. Effective Date
|
||||||
|
|
||||||
|
The licenses granted in Section 2.1 with respect to any Contribution
|
||||||
|
become effective for each Contribution on the date the Contributor first
|
||||||
|
distributes such Contribution.
|
||||||
|
|
||||||
|
2.3. Limitations on Grant Scope
|
||||||
|
|
||||||
|
The licenses granted in this Section 2 are the only rights granted under
|
||||||
|
this License. No additional rights or licenses will be implied from the
|
||||||
|
distribution or licensing of Covered Software under this License.
|
||||||
|
Notwithstanding Section 2.1(b) above, no patent license is granted by a
|
||||||
|
Contributor:
|
||||||
|
|
||||||
|
(a) for any code that a Contributor has removed from Covered Software;
|
||||||
|
or
|
||||||
|
|
||||||
|
(b) for infringements caused by: (i) Your and any other third party's
|
||||||
|
modifications of Covered Software, or (ii) the combination of its
|
||||||
|
Contributions with other software (except as part of its Contributor
|
||||||
|
Version); or
|
||||||
|
|
||||||
|
(c) under Patent Claims infringed by Covered Software in the absence of
|
||||||
|
its Contributions.
|
||||||
|
|
||||||
|
This License does not grant any rights in the trademarks, service marks,
|
||||||
|
or logos of any Contributor (except as may be necessary to comply with
|
||||||
|
the notice requirements in Section 3.4).
|
||||||
|
|
||||||
|
2.4. Subsequent Licenses
|
||||||
|
|
||||||
|
No Contributor makes additional grants as a result of Your choice to
|
||||||
|
distribute the Covered Software under a subsequent version of this
|
||||||
|
License (see Section 10.2) or under the terms of a Secondary License (if
|
||||||
|
permitted under the terms of Section 3.3).
|
||||||
|
|
||||||
|
2.5. Representation
|
||||||
|
|
||||||
|
Each Contributor represents that the Contributor believes its
|
||||||
|
Contributions are its original creation(s) or it has sufficient rights
|
||||||
|
to grant the rights to its Contributions conveyed by this License.
|
||||||
|
|
||||||
|
2.6. Fair Use
|
||||||
|
|
||||||
|
This License is not intended to limit any rights You have under
|
||||||
|
applicable copyright doctrines of fair use, fair dealing, or other
|
||||||
|
equivalents.
|
||||||
|
|
||||||
|
2.7. Conditions
|
||||||
|
|
||||||
|
Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted
|
||||||
|
in Section 2.1.
|
||||||
|
|
||||||
|
3. Responsibilities
|
||||||
|
-------------------
|
||||||
|
|
||||||
|
3.1. Distribution of Source Form
|
||||||
|
|
||||||
|
All distribution of Covered Software in Source Code Form, including any
|
||||||
|
Modifications that You create or to which You contribute, must be under
|
||||||
|
the terms of this License. You must inform recipients that the Source
|
||||||
|
Code Form of the Covered Software is governed by the terms of this
|
||||||
|
License, and how they can obtain a copy of this License. You may not
|
||||||
|
attempt to alter or restrict the recipients' rights in the Source Code
|
||||||
|
Form.
|
||||||
|
|
||||||
|
3.2. Distribution of Executable Form
|
||||||
|
|
||||||
|
If You distribute Covered Software in Executable Form then:
|
||||||
|
|
||||||
|
(a) such Covered Software must also be made available in Source Code
|
||||||
|
Form, as described in Section 3.1, and You must inform recipients of
|
||||||
|
the Executable Form how they can obtain a copy of such Source Code
|
||||||
|
Form by reasonable means in a timely manner, at a charge no more
|
||||||
|
than the cost of distribution to the recipient; and
|
||||||
|
|
||||||
|
(b) You may distribute such Executable Form under the terms of this
|
||||||
|
License, or sublicense it under different terms, provided that the
|
||||||
|
license for the Executable Form does not attempt to limit or alter
|
||||||
|
the recipients' rights in the Source Code Form under this License.
|
||||||
|
|
||||||
|
3.3. Distribution of a Larger Work
|
||||||
|
|
||||||
|
You may create and distribute a Larger Work under terms of Your choice,
|
||||||
|
provided that You also comply with the requirements of this License for
|
||||||
|
the Covered Software. If the Larger Work is a combination of Covered
|
||||||
|
Software with a work governed by one or more Secondary Licenses, and the
|
||||||
|
Covered Software is not Incompatible With Secondary Licenses, this
|
||||||
|
License permits You to additionally distribute such Covered Software
|
||||||
|
under the terms of such Secondary License(s), so that the recipient of
|
||||||
|
the Larger Work may, at their option, further distribute the Covered
|
||||||
|
Software under the terms of either this License or such Secondary
|
||||||
|
License(s).
|
||||||
|
|
||||||
|
3.4. Notices
|
||||||
|
|
||||||
|
You may not remove or alter the substance of any license notices
|
||||||
|
(including copyright notices, patent notices, disclaimers of warranty,
|
||||||
|
or limitations of liability) contained within the Source Code Form of
|
||||||
|
the Covered Software, except that You may alter any license notices to
|
||||||
|
the extent required to remedy known factual inaccuracies.
|
||||||
|
|
||||||
|
3.5. Application of Additional Terms
|
||||||
|
|
||||||
|
You may choose to offer, and to charge a fee for, warranty, support,
|
||||||
|
indemnity or liability obligations to one or more recipients of Covered
|
||||||
|
Software. However, You may do so only on Your own behalf, and not on
|
||||||
|
behalf of any Contributor. You must make it absolutely clear that any
|
||||||
|
such warranty, support, indemnity, or liability obligation is offered by
|
||||||
|
You alone, and You hereby agree to indemnify every Contributor for any
|
||||||
|
liability incurred by such Contributor as a result of warranty, support,
|
||||||
|
indemnity or liability terms You offer. You may include additional
|
||||||
|
disclaimers of warranty and limitations of liability specific to any
|
||||||
|
jurisdiction.
|
||||||
|
|
||||||
|
4. Inability to Comply Due to Statute or Regulation
|
||||||
|
---------------------------------------------------
|
||||||
|
|
||||||
|
If it is impossible for You to comply with any of the terms of this
|
||||||
|
License with respect to some or all of the Covered Software due to
|
||||||
|
statute, judicial order, or regulation then You must: (a) comply with
|
||||||
|
the terms of this License to the maximum extent possible; and (b)
|
||||||
|
describe the limitations and the code they affect. Such description must
|
||||||
|
be placed in a text file included with all distributions of the Covered
|
||||||
|
Software under this License. Except to the extent prohibited by statute
|
||||||
|
or regulation, such description must be sufficiently detailed for a
|
||||||
|
recipient of ordinary skill to be able to understand it.
|
||||||
|
|
||||||
|
5. Termination
|
||||||
|
--------------
|
||||||
|
|
||||||
|
5.1. The rights granted under this License will terminate automatically
|
||||||
|
if You fail to comply with any of its terms. However, if You become
|
||||||
|
compliant, then the rights granted under this License from a particular
|
||||||
|
Contributor are reinstated (a) provisionally, unless and until such
|
||||||
|
Contributor explicitly and finally terminates Your grants, and (b) on an
|
||||||
|
ongoing basis, if such Contributor fails to notify You of the
|
||||||
|
non-compliance by some reasonable means prior to 60 days after You have
|
||||||
|
come back into compliance. Moreover, Your grants from a particular
|
||||||
|
Contributor are reinstated on an ongoing basis if such Contributor
|
||||||
|
notifies You of the non-compliance by some reasonable means, this is the
|
||||||
|
first time You have received notice of non-compliance with this License
|
||||||
|
from such Contributor, and You become compliant prior to 30 days after
|
||||||
|
Your receipt of the notice.
|
||||||
|
|
||||||
|
5.2. If You initiate litigation against any entity by asserting a patent
|
||||||
|
infringement claim (excluding declaratory judgment actions,
|
||||||
|
counter-claims, and cross-claims) alleging that a Contributor Version
|
||||||
|
directly or indirectly infringes any patent, then the rights granted to
|
||||||
|
You by any and all Contributors for the Covered Software under Section
|
||||||
|
2.1 of this License shall terminate.
|
||||||
|
|
||||||
|
5.3. In the event of termination under Sections 5.1 or 5.2 above, all
|
||||||
|
end user license agreements (excluding distributors and resellers) which
|
||||||
|
have been validly granted by You or Your distributors under this License
|
||||||
|
prior to termination shall survive termination.
|
||||||
|
|
||||||
|
************************************************************************
|
||||||
|
* *
|
||||||
|
* 6. Disclaimer of Warranty *
|
||||||
|
* ------------------------- *
|
||||||
|
* *
|
||||||
|
* Covered Software is provided under this License on an "as is" *
|
||||||
|
* basis, without warranty of any kind, either expressed, implied, or *
|
||||||
|
* statutory, including, without limitation, warranties that the *
|
||||||
|
* Covered Software is free of defects, merchantable, fit for a *
|
||||||
|
* particular purpose or non-infringing. The entire risk as to the *
|
||||||
|
* quality and performance of the Covered Software is with You. *
|
||||||
|
* Should any Covered Software prove defective in any respect, You *
|
||||||
|
* (not any Contributor) assume the cost of any necessary servicing, *
|
||||||
|
* repair, or correction. This disclaimer of warranty constitutes an *
|
||||||
|
* essential part of this License. No use of any Covered Software is *
|
||||||
|
* authorized under this License except under this disclaimer. *
|
||||||
|
* *
|
||||||
|
************************************************************************
|
||||||
|
|
||||||
|
************************************************************************
|
||||||
|
* *
|
||||||
|
* 7. Limitation of Liability *
|
||||||
|
* -------------------------- *
|
||||||
|
* *
|
||||||
|
* Under no circumstances and under no legal theory, whether tort *
|
||||||
|
* (including negligence), contract, or otherwise, shall any *
|
||||||
|
* Contributor, or anyone who distributes Covered Software as *
|
||||||
|
* permitted above, be liable to You for any direct, indirect, *
|
||||||
|
* special, incidental, or consequential damages of any character *
|
||||||
|
* including, without limitation, damages for lost profits, loss of *
|
||||||
|
* goodwill, work stoppage, computer failure or malfunction, or any *
|
||||||
|
* and all other commercial damages or losses, even if such party *
|
||||||
|
* shall have been informed of the possibility of such damages. This *
|
||||||
|
* limitation of liability shall not apply to liability for death or *
|
||||||
|
* personal injury resulting from such party's negligence to the *
|
||||||
|
* extent applicable law prohibits such limitation. Some *
|
||||||
|
* jurisdictions do not allow the exclusion or limitation of *
|
||||||
|
* incidental or consequential damages, so this exclusion and *
|
||||||
|
* limitation may not apply to You. *
|
||||||
|
* *
|
||||||
|
************************************************************************
|
||||||
|
|
||||||
|
8. Litigation
|
||||||
|
-------------
|
||||||
|
|
||||||
|
Any litigation relating to this License may be brought only in the
|
||||||
|
courts of a jurisdiction where the defendant maintains its principal
|
||||||
|
place of business and such litigation shall be governed by laws of that
|
||||||
|
jurisdiction, without reference to its conflict-of-law provisions.
|
||||||
|
Nothing in this Section shall prevent a party's ability to bring
|
||||||
|
cross-claims or counter-claims.
|
||||||
|
|
||||||
|
9. Miscellaneous
|
||||||
|
----------------
|
||||||
|
|
||||||
|
This License represents the complete agreement concerning the subject
|
||||||
|
matter hereof. If any provision of this License is held to be
|
||||||
|
unenforceable, such provision shall be reformed only to the extent
|
||||||
|
necessary to make it enforceable. Any law or regulation which provides
|
||||||
|
that the language of a contract shall be construed against the drafter
|
||||||
|
shall not be used to construe this License against a Contributor.
|
||||||
|
|
||||||
|
10. Versions of the License
|
||||||
|
---------------------------
|
||||||
|
|
||||||
|
10.1. New Versions
|
||||||
|
|
||||||
|
Mozilla Foundation is the license steward. Except as provided in Section
|
||||||
|
10.3, no one other than the license steward has the right to modify or
|
||||||
|
publish new versions of this License. Each version will be given a
|
||||||
|
distinguishing version number.
|
||||||
|
|
||||||
|
10.2. Effect of New Versions
|
||||||
|
|
||||||
|
You may distribute the Covered Software under the terms of the version
|
||||||
|
of the License under which You originally received the Covered Software,
|
||||||
|
or under the terms of any subsequent version published by the license
|
||||||
|
steward.
|
||||||
|
|
||||||
|
10.3. Modified Versions
|
||||||
|
|
||||||
|
If you create software not governed by this License, and you want to
|
||||||
|
create a new license for such software, you may create and use a
|
||||||
|
modified version of this License if you rename the license and remove
|
||||||
|
any references to the name of the license steward (except to note that
|
||||||
|
such modified license differs from this License).
|
||||||
|
|
||||||
|
10.4. Distributing Source Code Form that is Incompatible With Secondary
|
||||||
|
Licenses
|
||||||
|
|
||||||
|
If You choose to distribute Source Code Form that is Incompatible With
|
||||||
|
Secondary Licenses under the terms of this version of the License, the
|
||||||
|
notice described in Exhibit B of this License must be attached.
|
||||||
|
|
||||||
|
Exhibit A - Source Code Form License Notice
|
||||||
|
-------------------------------------------
|
||||||
|
|
||||||
|
This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||||
|
|
||||||
|
If it is not possible or desirable to put the notice in a particular
|
||||||
|
file, then You may include the notice in a location (such as a LICENSE
|
||||||
|
file in a relevant directory) where a recipient would be likely to look
|
||||||
|
for such a notice.
|
||||||
|
|
||||||
|
You may add additional accurate notices of copyright ownership.
|
||||||
|
|
||||||
|
Exhibit B - "Incompatible With Secondary Licenses" Notice
|
||||||
|
---------------------------------------------------------
|
||||||
|
|
||||||
|
This Source Code Form is "Incompatible With Secondary Licenses", as
|
||||||
|
defined by the Mozilla Public License, v. 2.0.
|
||||||
|
|
||||||
|
Project-URL: Homepage, https://github.com/pyodide/micropip
|
||||||
|
Project-URL: Bug Tracker, https://github.com/pyodide/micropip/issues
|
||||||
|
Classifier: Programming Language :: Python :: 3
|
||||||
|
Classifier: License :: OSI Approved :: Mozilla Public License 2.0 (MPL 2.0)
|
||||||
|
Classifier: Operating System :: OS Independent
|
||||||
|
Requires-Python: >=3.10
|
||||||
|
Description-Content-Type: text/markdown
|
||||||
|
License-File: LICENSE
|
||||||
|
Requires-Dist: packaging >=23.0
|
||||||
|
Provides-Extra: test
|
||||||
|
Requires-Dist: pytest-httpserver ; extra == 'test'
|
||||||
|
Requires-Dist: pytest-pyodide ; extra == 'test'
|
||||||
|
Requires-Dist: pytest-cov ; extra == 'test'
|
||||||
|
Requires-Dist: pytest <8.0.0 ; extra == 'test'
|
||||||
|
Requires-Dist: build ==0.7.0 ; extra == 'test'
|
||||||
|
|
||||||
|
# micropip
|
||||||
|
|
||||||
|
[](https://pypi.org/project/micropip/)
|
||||||
|

|
||||||
|
|
||||||
|
A lightweight Python package installer for the web
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
In [Pyodide](https://pyodide.org), you can install micropip,
|
||||||
|
- either implicitly by importing it in the REPL
|
||||||
|
- or explicitly via `pyodide.loadPackage('micropip')`. You can also install by URL from PyPI for instance.
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
```py
|
||||||
|
import micropip
|
||||||
|
await micropip.install(<list-of-packages>)
|
||||||
|
```
|
||||||
|
For more information see the
|
||||||
|
[documentation](https://pyodide.org/en/stable/usage/loading-packages.html#micropip).
|
||||||
|
|
||||||
|
## License
|
||||||
|
|
||||||
|
micropip uses the [Mozilla Public License Version
|
||||||
|
2.0](https://choosealicense.com/licenses/mpl-2.0/).
|
||||||
135
dingus/pyodide/package.json
Normal file
135
dingus/pyodide/package.json
Normal file
|
|
@ -0,0 +1,135 @@
|
||||||
|
{
|
||||||
|
"name": "pyodide",
|
||||||
|
"version": "0.26.2",
|
||||||
|
"description": "The Pyodide JavaScript package",
|
||||||
|
"keywords": [
|
||||||
|
"python",
|
||||||
|
"webassembly"
|
||||||
|
],
|
||||||
|
"homepage": "https://github.com/pyodide/pyodide",
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/pyodide/pyodide"
|
||||||
|
},
|
||||||
|
"bugs": {
|
||||||
|
"url": "https://github.com/pyodide/pyodide/issues"
|
||||||
|
},
|
||||||
|
"license": "Apache-2.0",
|
||||||
|
"devDependencies": {
|
||||||
|
"@types/assert": "^1.5.6",
|
||||||
|
"@types/expect": "^24.3.0",
|
||||||
|
"@types/mocha": "^9.1.0",
|
||||||
|
"@types/node": "^20.8.4",
|
||||||
|
"@types/ws": "^8.5.3",
|
||||||
|
"chai": "^4.3.6",
|
||||||
|
"chai-as-promised": "^7.1.1",
|
||||||
|
"cross-env": "^7.0.3",
|
||||||
|
"dts-bundle-generator": "^8.1.1",
|
||||||
|
"esbuild": "^0.17.12",
|
||||||
|
"express": "^4.17.3",
|
||||||
|
"mocha": "^9.0.2",
|
||||||
|
"npm-run-all": "^4.1.5",
|
||||||
|
"nyc": "^15.1.0",
|
||||||
|
"prettier": "^2.2.1",
|
||||||
|
"ts-mocha": "^9.0.2",
|
||||||
|
"tsd": "^0.24.1",
|
||||||
|
"typedoc": "^0.25.1",
|
||||||
|
"typescript": "^4.6.4",
|
||||||
|
"wabt": "^1.0.32"
|
||||||
|
},
|
||||||
|
"main": "pyodide.js",
|
||||||
|
"exports": {
|
||||||
|
".": {
|
||||||
|
"require": "./pyodide.js",
|
||||||
|
"import": "./pyodide.mjs",
|
||||||
|
"types": "./pyodide.d.ts"
|
||||||
|
},
|
||||||
|
"./ffi": {
|
||||||
|
"types": "./ffi.d.ts"
|
||||||
|
},
|
||||||
|
"./pyodide.asm.wasm": "./pyodide.asm.wasm",
|
||||||
|
"./pyodide.asm.js": "./pyodide.asm.js",
|
||||||
|
"./python_stdlib.zip": "./python_stdlib.zip",
|
||||||
|
"./pyodide.mjs": "./pyodide.mjs",
|
||||||
|
"./pyodide.js": "./pyodide.js",
|
||||||
|
"./package.json": "./package.json",
|
||||||
|
"./pyodide-lock.json": "./pyodide-lock.json"
|
||||||
|
},
|
||||||
|
"files": [
|
||||||
|
"pyodide.asm.js",
|
||||||
|
"pyodide.asm.wasm",
|
||||||
|
"python_stdlib.zip",
|
||||||
|
"pyodide.mjs",
|
||||||
|
"pyodide.js.map",
|
||||||
|
"pyodide.mjs.map",
|
||||||
|
"pyodide.d.ts",
|
||||||
|
"ffi.d.ts",
|
||||||
|
"pyodide-lock.json",
|
||||||
|
"console.html"
|
||||||
|
],
|
||||||
|
"browser": {
|
||||||
|
"child_process": false,
|
||||||
|
"crypto": false,
|
||||||
|
"fs": false,
|
||||||
|
"fs/promises": false,
|
||||||
|
"path": false,
|
||||||
|
"url": false,
|
||||||
|
"vm": false,
|
||||||
|
"ws": false
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"build": "tsc --noEmit && node esbuild.config.mjs",
|
||||||
|
"test": "npm-run-all test:*",
|
||||||
|
"test:unit": "cross-env TEST_NODE=1 ts-mocha --node-option=experimental-loader=./test/loader.mjs --node-option=experimental-wasm-stack-switching -p tsconfig.test.json test/unit/**/*.test.*",
|
||||||
|
"test:node": "cross-env TEST_NODE=1 mocha test/integration/**/*.test.js",
|
||||||
|
"test:browser": "mocha test/integration/**/*.test.js",
|
||||||
|
"tsc": "tsc --noEmit",
|
||||||
|
"coverage": "cross-env TEST_NODE=1 npm-run-all coverage:*",
|
||||||
|
"coverage:build": "nyc npm run test:node"
|
||||||
|
},
|
||||||
|
"mocha": {
|
||||||
|
"bail": false,
|
||||||
|
"timeout": 30000,
|
||||||
|
"full-trace": true,
|
||||||
|
"inline-diffs": true,
|
||||||
|
"check-leaks": false,
|
||||||
|
"global": [
|
||||||
|
"pyodide",
|
||||||
|
"page",
|
||||||
|
"chai"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"nyc": {
|
||||||
|
"reporter": [
|
||||||
|
"html",
|
||||||
|
"text-summary"
|
||||||
|
],
|
||||||
|
"include": [
|
||||||
|
"*.ts"
|
||||||
|
],
|
||||||
|
"all": true,
|
||||||
|
"clean": true,
|
||||||
|
"cache": false,
|
||||||
|
"instrument": false,
|
||||||
|
"checkCoverage": true,
|
||||||
|
"statements": 95,
|
||||||
|
"functions": 95,
|
||||||
|
"branches": 80,
|
||||||
|
"lines": 95
|
||||||
|
},
|
||||||
|
"tsd": {
|
||||||
|
"compilerOptions": {
|
||||||
|
"lib": [
|
||||||
|
"ES2017",
|
||||||
|
"DOM"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"ws": "^8.5.0"
|
||||||
|
},
|
||||||
|
"types": "./pyodide.d.ts",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=18.0.0"
|
||||||
|
}
|
||||||
|
}
|
||||||
102
dingus/pyodide/packaging-23.2-py3-none-any.whl.metadata
Normal file
102
dingus/pyodide/packaging-23.2-py3-none-any.whl.metadata
Normal file
|
|
@ -0,0 +1,102 @@
|
||||||
|
Metadata-Version: 2.1
|
||||||
|
Name: packaging
|
||||||
|
Version: 23.2
|
||||||
|
Summary: Core utilities for Python packages
|
||||||
|
Author-email: Donald Stufft <donald@stufft.io>
|
||||||
|
Requires-Python: >=3.7
|
||||||
|
Description-Content-Type: text/x-rst
|
||||||
|
Classifier: Development Status :: 5 - Production/Stable
|
||||||
|
Classifier: Intended Audience :: Developers
|
||||||
|
Classifier: License :: OSI Approved :: Apache Software License
|
||||||
|
Classifier: License :: OSI Approved :: BSD License
|
||||||
|
Classifier: Programming Language :: Python
|
||||||
|
Classifier: Programming Language :: Python :: 3
|
||||||
|
Classifier: Programming Language :: Python :: 3 :: Only
|
||||||
|
Classifier: Programming Language :: Python :: 3.7
|
||||||
|
Classifier: Programming Language :: Python :: 3.8
|
||||||
|
Classifier: Programming Language :: Python :: 3.9
|
||||||
|
Classifier: Programming Language :: Python :: 3.10
|
||||||
|
Classifier: Programming Language :: Python :: 3.11
|
||||||
|
Classifier: Programming Language :: Python :: 3.12
|
||||||
|
Classifier: Programming Language :: Python :: Implementation :: CPython
|
||||||
|
Classifier: Programming Language :: Python :: Implementation :: PyPy
|
||||||
|
Classifier: Typing :: Typed
|
||||||
|
Project-URL: Documentation, https://packaging.pypa.io/
|
||||||
|
Project-URL: Source, https://github.com/pypa/packaging
|
||||||
|
|
||||||
|
packaging
|
||||||
|
=========
|
||||||
|
|
||||||
|
.. start-intro
|
||||||
|
|
||||||
|
Reusable core utilities for various Python Packaging
|
||||||
|
`interoperability specifications <https://packaging.python.org/specifications/>`_.
|
||||||
|
|
||||||
|
This library provides utilities that implement the interoperability
|
||||||
|
specifications which have clearly one correct behaviour (eg: :pep:`440`)
|
||||||
|
or benefit greatly from having a single shared implementation (eg: :pep:`425`).
|
||||||
|
|
||||||
|
.. end-intro
|
||||||
|
|
||||||
|
The ``packaging`` project includes the following: version handling, specifiers,
|
||||||
|
markers, requirements, tags, utilities.
|
||||||
|
|
||||||
|
Documentation
|
||||||
|
-------------
|
||||||
|
|
||||||
|
The `documentation`_ provides information and the API for the following:
|
||||||
|
|
||||||
|
- Version Handling
|
||||||
|
- Specifiers
|
||||||
|
- Markers
|
||||||
|
- Requirements
|
||||||
|
- Tags
|
||||||
|
- Utilities
|
||||||
|
|
||||||
|
Installation
|
||||||
|
------------
|
||||||
|
|
||||||
|
Use ``pip`` to install these utilities::
|
||||||
|
|
||||||
|
pip install packaging
|
||||||
|
|
||||||
|
The ``packaging`` library uses calendar-based versioning (``YY.N``).
|
||||||
|
|
||||||
|
Discussion
|
||||||
|
----------
|
||||||
|
|
||||||
|
If you run into bugs, you can file them in our `issue tracker`_.
|
||||||
|
|
||||||
|
You can also join ``#pypa`` on Freenode to ask questions or get involved.
|
||||||
|
|
||||||
|
|
||||||
|
.. _`documentation`: https://packaging.pypa.io/
|
||||||
|
.. _`issue tracker`: https://github.com/pypa/packaging/issues
|
||||||
|
|
||||||
|
|
||||||
|
Code of Conduct
|
||||||
|
---------------
|
||||||
|
|
||||||
|
Everyone interacting in the packaging project's codebases, issue trackers, chat
|
||||||
|
rooms, and mailing lists is expected to follow the `PSF Code of Conduct`_.
|
||||||
|
|
||||||
|
.. _PSF Code of Conduct: https://github.com/pypa/.github/blob/main/CODE_OF_CONDUCT.md
|
||||||
|
|
||||||
|
Contributing
|
||||||
|
------------
|
||||||
|
|
||||||
|
The ``CONTRIBUTING.rst`` file outlines how to contribute to this project as
|
||||||
|
well as how to report a potential security issue. The documentation for this
|
||||||
|
project also covers information about `project development`_ and `security`_.
|
||||||
|
|
||||||
|
.. _`project development`: https://packaging.pypa.io/en/latest/development/
|
||||||
|
.. _`security`: https://packaging.pypa.io/en/latest/security/
|
||||||
|
|
||||||
|
Project History
|
||||||
|
---------------
|
||||||
|
|
||||||
|
Please review the ``CHANGELOG.rst`` file or the `Changelog documentation`_ for
|
||||||
|
recent changes and project history.
|
||||||
|
|
||||||
|
.. _`Changelog documentation`: https://packaging.pypa.io/en/latest/changelog/
|
||||||
|
|
||||||
BIN
dingus/pyodide/pyodide-core-0.26.2.tar
Normal file
BIN
dingus/pyodide/pyodide-core-0.26.2.tar
Normal file
Binary file not shown.
1
dingus/pyodide/pyodide-lock.json
Normal file
1
dingus/pyodide/pyodide-lock.json
Normal file
File diff suppressed because one or more lines are too long
17
dingus/pyodide/pyodide.asm.js
Normal file
17
dingus/pyodide/pyodide.asm.js
Normal file
File diff suppressed because one or more lines are too long
BIN
dingus/pyodide/pyodide.asm.wasm
Executable file
BIN
dingus/pyodide/pyodide.asm.wasm
Executable file
Binary file not shown.
1561
dingus/pyodide/pyodide.d.ts
vendored
Normal file
1561
dingus/pyodide/pyodide.d.ts
vendored
Normal file
File diff suppressed because it is too large
Load diff
6
dingus/pyodide/pyodide.js
Normal file
6
dingus/pyodide/pyodide.js
Normal file
File diff suppressed because one or more lines are too long
4
dingus/pyodide/pyodide.mjs
Normal file
4
dingus/pyodide/pyodide.mjs
Normal file
File diff suppressed because one or more lines are too long
BIN
dingus/pyodide/python_stdlib.zip
Normal file
BIN
dingus/pyodide/python_stdlib.zip
Normal file
Binary file not shown.
79
dingus/srvit.py
Executable file
79
dingus/srvit.py
Executable file
|
|
@ -0,0 +1,79 @@
|
||||||
|
#!/usr/bin/env python3
|
||||||
|
import os
|
||||||
|
|
||||||
|
from http.server import test, SimpleHTTPRequestHandler, ThreadingHTTPServer
|
||||||
|
|
||||||
|
|
||||||
|
class MyHTTPRequestHandler(SimpleHTTPRequestHandler):
|
||||||
|
def __init__(self, *args, **kwargs):
|
||||||
|
super().__init__(*args, **kwargs)
|
||||||
|
self.extensions_map[".js"] = "application/javascript"
|
||||||
|
self.extensions_map[".wasm"] = "application/wasm"
|
||||||
|
|
||||||
|
def end_headers(self):
|
||||||
|
self.send_my_headers()
|
||||||
|
super().end_headers()
|
||||||
|
|
||||||
|
def send_my_headers(self):
|
||||||
|
if "pyodide" not in self.path:
|
||||||
|
self.send_header("Cache-Control", "no-cache, no-store, must-revalidate")
|
||||||
|
self.send_header("Pragma", "no-cache")
|
||||||
|
self.send_header("Expires", "0")
|
||||||
|
|
||||||
|
self.send_header("Cross-Origin-Opener-Policy", "same-origin")
|
||||||
|
self.send_header("Cross-Origin-Embedder-Policy", "require-corp")
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
import argparse
|
||||||
|
import contextlib
|
||||||
|
|
||||||
|
parser = argparse.ArgumentParser()
|
||||||
|
parser.add_argument(
|
||||||
|
"-b",
|
||||||
|
"--bind",
|
||||||
|
metavar="ADDRESS",
|
||||||
|
help="bind to this address " "(default: all interfaces)",
|
||||||
|
)
|
||||||
|
parser.add_argument(
|
||||||
|
"-d",
|
||||||
|
"--directory",
|
||||||
|
default=os.getcwd(),
|
||||||
|
help="serve this directory " "(default: current directory)",
|
||||||
|
)
|
||||||
|
parser.add_argument(
|
||||||
|
"-p",
|
||||||
|
"--protocol",
|
||||||
|
metavar="VERSION",
|
||||||
|
default="HTTP/1.0",
|
||||||
|
help="conform to this HTTP version " "(default: %(default)s)",
|
||||||
|
)
|
||||||
|
parser.add_argument(
|
||||||
|
"port",
|
||||||
|
default=8000,
|
||||||
|
type=int,
|
||||||
|
nargs="?",
|
||||||
|
help="bind to this port " "(default: %(default)s)",
|
||||||
|
)
|
||||||
|
args = parser.parse_args()
|
||||||
|
handler_class = MyHTTPRequestHandler
|
||||||
|
|
||||||
|
# ensure dual-stack is not disabled; ref #38907
|
||||||
|
class DualStackServer(ThreadingHTTPServer):
|
||||||
|
|
||||||
|
def server_bind(self):
|
||||||
|
# suppress exception when protocol is IPv4
|
||||||
|
with contextlib.suppress(Exception):
|
||||||
|
self.socket.setsockopt(socket.IPPROTO_IPV6, socket.IPV6_V6ONLY, 0)
|
||||||
|
return super().server_bind()
|
||||||
|
|
||||||
|
def finish_request(self, request, client_address):
|
||||||
|
self.RequestHandlerClass(request, client_address, self, directory=args.directory)
|
||||||
|
|
||||||
|
test(
|
||||||
|
HandlerClass=handler_class,
|
||||||
|
ServerClass=DualStackServer,
|
||||||
|
port=args.port,
|
||||||
|
bind=args.bind,
|
||||||
|
protocol=args.protocol,
|
||||||
|
)
|
||||||
41
dingus/style.css
Normal file
41
dingus/style.css
Normal file
|
|
@ -0,0 +1,41 @@
|
||||||
|
/* set codemirror ide height to 100% of the textarea */
|
||||||
|
body {
|
||||||
|
height: 100vh;
|
||||||
|
box-sizing: border-box;
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.page-container {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: 1fr 1fr 1fr;
|
||||||
|
grid-template-rows: 4rem 1fr;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.grammar-container {
|
||||||
|
grid-column: 1;
|
||||||
|
grid-row: 2;
|
||||||
|
padding: 0.25rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.input-container {
|
||||||
|
grid-column: 2;
|
||||||
|
grid-row: 2;
|
||||||
|
padding: 0.25rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.results-container {
|
||||||
|
grid-column: 3;
|
||||||
|
grid-row: 2;
|
||||||
|
padding: 0.25rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.main-textarea {
|
||||||
|
height: 100%;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.CodeMirror {
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
89
dingus/worker.js
Normal file
89
dingus/worker.js
Normal file
|
|
@ -0,0 +1,89 @@
|
||||||
|
const PARSER_PACKAGE = "./wheel/lrparsers-0.7.9-py3-none-any.whl"
|
||||||
|
|
||||||
|
|
||||||
|
// Load the whole pyodide thingy.
|
||||||
|
importScripts("pyodide/pyodide.js");
|
||||||
|
|
||||||
|
const dingus_module = {
|
||||||
|
post_grammar_status: function (message) {
|
||||||
|
console.log("Grammar Status:", message);
|
||||||
|
postMessage({kind: "grammar_status", status: "loading", message});
|
||||||
|
},
|
||||||
|
|
||||||
|
post_grammar_loaded: function () {
|
||||||
|
console.log("Grammar Loaded");
|
||||||
|
postMessage({kind: "grammar_status", status: "ok", message: "Grammar loaded"});
|
||||||
|
},
|
||||||
|
|
||||||
|
post_grammar_error: function(error) {
|
||||||
|
console.log("Grammar Error:", error);
|
||||||
|
postMessage({kind:"grammar_status", status: "error", message: error});
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
async function setup_python() {
|
||||||
|
console.log("Loading pyodide....");
|
||||||
|
const pyodide = await loadPyodide({
|
||||||
|
packages: ["micropip"],
|
||||||
|
});
|
||||||
|
pyodide.setStdout({ batched: (msg) => console.log(msg) }); // TODO: I know this is an option above.
|
||||||
|
|
||||||
|
// TODO: Do I actually want micropip? Probably not?
|
||||||
|
console.log("Installing parser package...");
|
||||||
|
const micropip = pyodide.pyimport("micropip");
|
||||||
|
await micropip.install(PARSER_PACKAGE);
|
||||||
|
|
||||||
|
pyodide.registerJsModule("dingus", dingus_module);
|
||||||
|
|
||||||
|
pyodide.runPython(`
|
||||||
|
import dingus
|
||||||
|
import parser
|
||||||
|
import pyodide.code
|
||||||
|
|
||||||
|
GRAMMAR_GLOBALS = {}
|
||||||
|
|
||||||
|
def eval_grammar(code):
|
||||||
|
global GRAMMAR_GLOBALS
|
||||||
|
try:
|
||||||
|
dingus.post_grammar_status("Evaluating grammar...")
|
||||||
|
pyodide.code.eval_code(code, globals=GRAMMAR_GLOBALS)
|
||||||
|
dingus.post_grammar_loaded()
|
||||||
|
except Exception as e:
|
||||||
|
dingus.post_grammar_error(f"{e}")
|
||||||
|
`);
|
||||||
|
|
||||||
|
console.log("Loaded!");
|
||||||
|
self.pyodide = pyodide;
|
||||||
|
return pyodide;
|
||||||
|
}
|
||||||
|
const pyodide_promise = setup_python();
|
||||||
|
|
||||||
|
|
||||||
|
async function load_grammar_module(code) {
|
||||||
|
const pyodide = self.pyodide;
|
||||||
|
|
||||||
|
console.log("Running...");
|
||||||
|
|
||||||
|
const my_fn = pyodide.globals.get("eval_grammar");
|
||||||
|
my_fn(code);
|
||||||
|
my_fn.destroy();
|
||||||
|
}
|
||||||
|
|
||||||
|
self.onmessage = async function(event) {
|
||||||
|
await pyodide_promise;
|
||||||
|
|
||||||
|
try {
|
||||||
|
const { kind, data } = event.data;
|
||||||
|
if (kind === "grammar_module") {
|
||||||
|
try {
|
||||||
|
await load_grammar_module(data);
|
||||||
|
} catch (e) {
|
||||||
|
console.log("INTERNAL ERROR:", e.message);
|
||||||
|
postMessage({error: e.message});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (wtf) {
|
||||||
|
console.log("WTF?");
|
||||||
|
console.log(wtf);
|
||||||
|
}
|
||||||
|
};
|
||||||
Loading…
Add table
Add a link
Reference in a new issue