-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpython.html
More file actions
217 lines (186 loc) · 8.42 KB
/
Copy pathpython.html
File metadata and controls
217 lines (186 loc) · 8.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<link href="https://fonts.googleapis.com/css?family=JetBrains%20Mono" rel="stylesheet">
<link rel="stylesheet" type="text/css" href="index.css">
<title>TidyPython</title>
<link rel="icon" href="/pluginIcon.svg" type="image/svg+xml">
<style>
body {
margin: 0 auto; /* center page */
max-width: 1400px; /* wider */
padding: 5px 24px; /* keep similar padding */
}
#content {
display: block; /* no grid */
height: auto; /* let editor define height */
width: 100%;
max-width: 1400px;
margin: 0 auto; /* centered */
}
.CodeMirror {
height: 700px;
width: 100%;
border-radius: 14px;
overflow: hidden;
background: var(--panel-background);
border: 1px solid rgba(0,0,0,0.18);
font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
font-size: 16px;
}
#confrow1, #confrow2 {
max-width: 1400px;
margin: 20px auto 0;
padding: 0 10px;
margin-right: 0;
}
#confrow1 {
justify-content: space-between;
align-items: center;
gap: 16px;
flex-wrap: wrap;
}
#blackStatus .formatter-glyph {
display: block;
font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
font-size: 15px;
font-weight: 800;
line-height: 1;
letter-spacing: 0;
color: #586e75;
pointer-events: none;
}
#blackStatus.ready .formatter-glyph {
color: #268bd2;
}
#neural-reranker-label {
display: inline-flex;
align-items: center;
gap: 0.35em;
margin-left: 1.2em;
white-space: nowrap;
}
#neural-reranker-label.is-disabled {
color: #839496;
cursor: not-allowed;
}
#neural-reranker-checkbox:disabled {
cursor: not-allowed;
}
</style>
<!-- CodeMirror 5 -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/codemirror@5.65.16/lib/codemirror.min.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/codemirror@5.65.16/addon/lint/lint.min.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/codemirror@5.65.16/addon/hint/show-hint.min.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/codemirror@5.65.16/theme/material-darker.min.css">
<style>
/* must come after codemirror.min.css */
#content .CodeMirror { height: 700px !important; }
#tidyparse-output {
display: none !important;
}
.CodeMirror .cm-squiggle {
text-decoration: underline wavy red;
-webkit-text-decoration: underline wavy red;
text-underline-offset: 2px;
}
/* Material-darker styled hint dropdown */
.CodeMirror-hints {
background: #212121 !important; /* material-darker panel */
color: #e0e0e0 !important;
border: 1px solid rgba(255,255,255,0.12) !important;
box-shadow: 0 8px 24px rgba(0,0,0,0.35) !important;
border-radius: 10px;
padding: 4px 0;
font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
font-size: 14px;
}
.CodeMirror-hint {
color: inherit !important;
padding: 2px 10px;
}
.CodeMirror-hint-active {
background: rgba(255,255,255,0.10) !important;
color: #ffffff !important;
}
.CodeMirror-hint span { color: inherit; }
.CodeMirror-gutter.cm-warn-gutter { width: 14px; }
</style>
</head>
<body>
<h1><img style="display: inline;" src="/pluginIcon.svg" width="26"> TidyPython Browser Demonstration</h1>
<div id="content">
<textarea id="tidyparse-input" spellcheck="false"># Try modifying one of the malformed lines in the editor below
# Works best on Chrome (tested 143.0.7499.170+arm64), the WebGPU logo should appear in the lower left corner if enabled
# Invalid lines are marked with ⚠️ in the gutter
x = 1 -
x = 1 + 1
[ i for i in j ] ]
[ i for i in j ]
[ i + j for i, j in zip(*[iter(data)] * 2)
stripped_lines = lambda f : l.rstrip("\n") for l in f
stripped_lines = lambda f : (l.rstrip("\n") for l in f)
newlist = [word for word in words if len(word) == 9)
newlist = [word for word in words if len(word) == 9]
[v for i, v in enumerate(arr, 1) if (i & (i - 1)]
Keys = [x for x in d if d[x] == 'a')]
Keys = [x for x in d if d[x] == 'a']
gen_fun = lambda num: ((x for u in range(num) for x in (u*2, u*10, u*u))
gen_fun = lambda num: (x for u in range(num) for x in (u*2, u*10, u*u))
[2 * x if x > 2 else **add_nothing_to_list** for x in some_list]
[2 * x if x > 2 else add_nothing_to_list for x in some_list]
lines = [[float(x) for x in line] for line in in csv.reader(f)]
lines = [[float(x) for x in line] for line in csv.reader(f)]
filtered = [x if x in words for x in common]
filtered = [x for x in common if x in words]
(,) + (1, 'a') + (2, 'b') + (3, 'c')
() + (1, 'a') + (2, 'b') + (3, 'c')</textarea>
</div>
<div id="tidyparse-output" class="panel" style="display:none"></div>
<div id="confrow1">
<div class="runtime-status-group" aria-label="Runtime status">
<div id="gpuAvail" class="runtime-status-item pending" role="status" aria-label="WebGPU loading" title="WebGPU loading">
<object type="image/svg+xml" data="/webgpu.svg" width="24" height="24" aria-label="WebGPU"></object>
<span class="runtime-status-dot"></span>
</div>
<div id="pyWorkerStatus" class="runtime-status-item pending" role="status" aria-label="Python workers loading" title="Python workers loading">
<img src="/python-logo-only.svg" alt="">
<span class="runtime-status-dot"></span>
</div>
<div id="blackStatus" class="runtime-status-item pending" role="status" aria-label="Python formatter loading" title="Python formatter loading">
<span class="formatter-glyph" aria-hidden="true"></></span>
<span class="runtime-status-dot"></span>
</div>
<div id="neuralRerankerStatus" class="runtime-status-item pending" role="status" aria-label="Neural reranker waiting for WebGPU" title="Neural reranker waiting for WebGPU">
<svg viewBox="0 0 24 24" aria-label="Neural reranker">
<rect x="3.5" y="5" width="9" height="3.5" rx="0.9" />
<rect x="3.5" y="10.25" width="9" height="3.5" rx="0.9" />
<rect x="3.5" y="15.5" width="9" height="3.5" rx="0.9" />
<path d="M15 17.25c4.7-2.2 4.7-8.3 0-10.5" />
<path d="M17.6 6.95 15 6.75l1.12 2.35" />
</svg>
<span class="runtime-status-dot"></span>
</div>
</div>
<label title="Minimizes total edits per repair.">
Max edit distance:
<a href="https://en.wikipedia.org/wiki/Edit_distance#Language_edit_distance">LED</a> +
<input id="led-buffer" type="number" value="2" min="0" max="3" step="1" style="margin-right: 1.2em">
</label>
<label id="neural-reranker-label" class="is-disabled" title="Neural reranker waiting for WebGPU">
<input id="neural-reranker-checkbox" type="checkbox" disabled>
Neural reranker
</label>
</div>
<script type="text/javascript">var PROGRAMMING_LANG = "python"</script>
<!-- CodeMirror 5 -->
<script src="https://cdn.jsdelivr.net/npm/codemirror@5.65.16/lib/codemirror.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/codemirror@5.65.16/mode/python/python.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/codemirror@5.65.16/addon/hint/show-hint.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/codemirror@5.65.16/addon/lint/lint.min.js"></script>
<script src="https://cdn.jsdelivr.net/pyodide/v0.27.5/full/pyodide.js"></script>
<script src="tidyparse-python-resources.js"></script>
<script src="tidyparse-core.js"></script>
</body>
</html>