asciidoctor-html 2.1.7 → 2.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.rubocop.yml +1 -1
- data/CHANGELOG.md +5 -0
- data/Rakefile +4 -3
- data/assets/css/styles.css +2 -2
- data/lib/asciidoctor/html/book.rb +10 -2
- data/lib/asciidoctor/html/cli.rb +6 -14
- data/lib/asciidoctor/html/flip.rb +22 -1
- data/lib/asciidoctor/html/jupyterlite.rb +13 -8
- data/lib/asciidoctor/html/reuse_block_macro.rb +39 -0
- data/lib/asciidoctor/html/utils.rb +10 -0
- data/lib/asciidoctor/html/version.rb +1 -1
- metadata +5 -9
- data/exe/build-jupyterlite +0 -35
- data/jupyterlite/content/data/matplotlib.png +0 -0
- data/jupyterlite/content/pyodide/matplotlib.ipynb +0 -113
- data/jupyterlite/content/python.ipynb +0 -721
|
@@ -1,721 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"cells": [
|
|
3
|
-
{
|
|
4
|
-
"attachments": {},
|
|
5
|
-
"cell_type": "markdown",
|
|
6
|
-
"metadata": {
|
|
7
|
-
"tags": []
|
|
8
|
-
},
|
|
9
|
-
"source": [
|
|
10
|
-
"# A Python kernel backed by Pyodide\n",
|
|
11
|
-
"\n",
|
|
12
|
-
""
|
|
13
|
-
]
|
|
14
|
-
},
|
|
15
|
-
{
|
|
16
|
-
"cell_type": "code",
|
|
17
|
-
"execution_count": null,
|
|
18
|
-
"metadata": {
|
|
19
|
-
"trusted": true
|
|
20
|
-
},
|
|
21
|
-
"outputs": [],
|
|
22
|
-
"source": [
|
|
23
|
-
"import pyodide_kernel\n",
|
|
24
|
-
"pyodide_kernel.__version__"
|
|
25
|
-
]
|
|
26
|
-
},
|
|
27
|
-
{
|
|
28
|
-
"cell_type": "markdown",
|
|
29
|
-
"metadata": {},
|
|
30
|
-
"source": [
|
|
31
|
-
"# Simple code execution"
|
|
32
|
-
]
|
|
33
|
-
},
|
|
34
|
-
{
|
|
35
|
-
"cell_type": "code",
|
|
36
|
-
"execution_count": null,
|
|
37
|
-
"metadata": {
|
|
38
|
-
"trusted": true
|
|
39
|
-
},
|
|
40
|
-
"outputs": [],
|
|
41
|
-
"source": [
|
|
42
|
-
"a = 3"
|
|
43
|
-
]
|
|
44
|
-
},
|
|
45
|
-
{
|
|
46
|
-
"cell_type": "code",
|
|
47
|
-
"execution_count": null,
|
|
48
|
-
"metadata": {
|
|
49
|
-
"trusted": true
|
|
50
|
-
},
|
|
51
|
-
"outputs": [],
|
|
52
|
-
"source": [
|
|
53
|
-
"a"
|
|
54
|
-
]
|
|
55
|
-
},
|
|
56
|
-
{
|
|
57
|
-
"cell_type": "code",
|
|
58
|
-
"execution_count": null,
|
|
59
|
-
"metadata": {
|
|
60
|
-
"trusted": true
|
|
61
|
-
},
|
|
62
|
-
"outputs": [],
|
|
63
|
-
"source": [
|
|
64
|
-
"b = 89\n",
|
|
65
|
-
"\n",
|
|
66
|
-
"def sq(x):\n",
|
|
67
|
-
" return x * x\n",
|
|
68
|
-
"\n",
|
|
69
|
-
"sq(b)"
|
|
70
|
-
]
|
|
71
|
-
},
|
|
72
|
-
{
|
|
73
|
-
"cell_type": "code",
|
|
74
|
-
"execution_count": null,
|
|
75
|
-
"metadata": {
|
|
76
|
-
"trusted": true
|
|
77
|
-
},
|
|
78
|
-
"outputs": [],
|
|
79
|
-
"source": [
|
|
80
|
-
"print"
|
|
81
|
-
]
|
|
82
|
-
},
|
|
83
|
-
{
|
|
84
|
-
"cell_type": "markdown",
|
|
85
|
-
"metadata": {
|
|
86
|
-
"tags": []
|
|
87
|
-
},
|
|
88
|
-
"source": [
|
|
89
|
-
"# Redirected streams"
|
|
90
|
-
]
|
|
91
|
-
},
|
|
92
|
-
{
|
|
93
|
-
"cell_type": "code",
|
|
94
|
-
"execution_count": null,
|
|
95
|
-
"metadata": {
|
|
96
|
-
"trusted": true
|
|
97
|
-
},
|
|
98
|
-
"outputs": [],
|
|
99
|
-
"source": [
|
|
100
|
-
"import sys\n",
|
|
101
|
-
"\n",
|
|
102
|
-
"print(\"Error !!\", file=sys.stderr)"
|
|
103
|
-
]
|
|
104
|
-
},
|
|
105
|
-
{
|
|
106
|
-
"cell_type": "markdown",
|
|
107
|
-
"metadata": {},
|
|
108
|
-
"source": [
|
|
109
|
-
"# Error handling"
|
|
110
|
-
]
|
|
111
|
-
},
|
|
112
|
-
{
|
|
113
|
-
"cell_type": "code",
|
|
114
|
-
"execution_count": null,
|
|
115
|
-
"metadata": {
|
|
116
|
-
"scrolled": true,
|
|
117
|
-
"trusted": true
|
|
118
|
-
},
|
|
119
|
-
"outputs": [],
|
|
120
|
-
"source": [
|
|
121
|
-
"\"Hello\"\n",
|
|
122
|
-
"\n",
|
|
123
|
-
"def dummy_function():\n",
|
|
124
|
-
" import missing_module"
|
|
125
|
-
]
|
|
126
|
-
},
|
|
127
|
-
{
|
|
128
|
-
"cell_type": "code",
|
|
129
|
-
"execution_count": null,
|
|
130
|
-
"metadata": {
|
|
131
|
-
"trusted": true
|
|
132
|
-
},
|
|
133
|
-
"outputs": [],
|
|
134
|
-
"source": [
|
|
135
|
-
"dummy_function()"
|
|
136
|
-
]
|
|
137
|
-
},
|
|
138
|
-
{
|
|
139
|
-
"cell_type": "markdown",
|
|
140
|
-
"metadata": {},
|
|
141
|
-
"source": [
|
|
142
|
-
"# Code completion"
|
|
143
|
-
]
|
|
144
|
-
},
|
|
145
|
-
{
|
|
146
|
-
"cell_type": "markdown",
|
|
147
|
-
"metadata": {},
|
|
148
|
-
"source": [
|
|
149
|
-
"### press `tab` to see what is available in `sys` module"
|
|
150
|
-
]
|
|
151
|
-
},
|
|
152
|
-
{
|
|
153
|
-
"cell_type": "code",
|
|
154
|
-
"execution_count": null,
|
|
155
|
-
"metadata": {
|
|
156
|
-
"trusted": true
|
|
157
|
-
},
|
|
158
|
-
"outputs": [],
|
|
159
|
-
"source": [
|
|
160
|
-
"from sys import "
|
|
161
|
-
]
|
|
162
|
-
},
|
|
163
|
-
{
|
|
164
|
-
"cell_type": "markdown",
|
|
165
|
-
"metadata": {},
|
|
166
|
-
"source": [
|
|
167
|
-
"# Code inspection"
|
|
168
|
-
]
|
|
169
|
-
},
|
|
170
|
-
{
|
|
171
|
-
"cell_type": "markdown",
|
|
172
|
-
"metadata": {},
|
|
173
|
-
"source": [
|
|
174
|
-
"### using the question mark"
|
|
175
|
-
]
|
|
176
|
-
},
|
|
177
|
-
{
|
|
178
|
-
"cell_type": "code",
|
|
179
|
-
"execution_count": null,
|
|
180
|
-
"metadata": {
|
|
181
|
-
"trusted": true
|
|
182
|
-
},
|
|
183
|
-
"outputs": [],
|
|
184
|
-
"source": [
|
|
185
|
-
"?print"
|
|
186
|
-
]
|
|
187
|
-
},
|
|
188
|
-
{
|
|
189
|
-
"cell_type": "markdown",
|
|
190
|
-
"metadata": {},
|
|
191
|
-
"source": [
|
|
192
|
-
"### by pressing `shift+tab`"
|
|
193
|
-
]
|
|
194
|
-
},
|
|
195
|
-
{
|
|
196
|
-
"cell_type": "code",
|
|
197
|
-
"execution_count": null,
|
|
198
|
-
"metadata": {
|
|
199
|
-
"trusted": true
|
|
200
|
-
},
|
|
201
|
-
"outputs": [],
|
|
202
|
-
"source": [
|
|
203
|
-
"print("
|
|
204
|
-
]
|
|
205
|
-
},
|
|
206
|
-
{
|
|
207
|
-
"cell_type": "markdown",
|
|
208
|
-
"metadata": {},
|
|
209
|
-
"source": [
|
|
210
|
-
"# Input support"
|
|
211
|
-
]
|
|
212
|
-
},
|
|
213
|
-
{
|
|
214
|
-
"cell_type": "code",
|
|
215
|
-
"execution_count": null,
|
|
216
|
-
"metadata": {
|
|
217
|
-
"trusted": true
|
|
218
|
-
},
|
|
219
|
-
"outputs": [],
|
|
220
|
-
"source": [
|
|
221
|
-
"name = await input('Enter your name: ')"
|
|
222
|
-
]
|
|
223
|
-
},
|
|
224
|
-
{
|
|
225
|
-
"cell_type": "code",
|
|
226
|
-
"execution_count": null,
|
|
227
|
-
"metadata": {
|
|
228
|
-
"trusted": true
|
|
229
|
-
},
|
|
230
|
-
"outputs": [],
|
|
231
|
-
"source": [
|
|
232
|
-
"'Hello, ' + name"
|
|
233
|
-
]
|
|
234
|
-
},
|
|
235
|
-
{
|
|
236
|
-
"cell_type": "markdown",
|
|
237
|
-
"metadata": {},
|
|
238
|
-
"source": [
|
|
239
|
-
"# Rich representation"
|
|
240
|
-
]
|
|
241
|
-
},
|
|
242
|
-
{
|
|
243
|
-
"cell_type": "code",
|
|
244
|
-
"execution_count": null,
|
|
245
|
-
"metadata": {
|
|
246
|
-
"trusted": true
|
|
247
|
-
},
|
|
248
|
-
"outputs": [],
|
|
249
|
-
"source": [
|
|
250
|
-
"from IPython.display import display, Markdown, HTML, JSON, Latex"
|
|
251
|
-
]
|
|
252
|
-
},
|
|
253
|
-
{
|
|
254
|
-
"cell_type": "markdown",
|
|
255
|
-
"metadata": {
|
|
256
|
-
"tags": []
|
|
257
|
-
},
|
|
258
|
-
"source": [
|
|
259
|
-
"## HTML"
|
|
260
|
-
]
|
|
261
|
-
},
|
|
262
|
-
{
|
|
263
|
-
"cell_type": "code",
|
|
264
|
-
"execution_count": null,
|
|
265
|
-
"metadata": {
|
|
266
|
-
"trusted": true
|
|
267
|
-
},
|
|
268
|
-
"outputs": [],
|
|
269
|
-
"source": [
|
|
270
|
-
"print('Before display')\n",
|
|
271
|
-
"\n",
|
|
272
|
-
"s = '<h1>HTML Title</h1>'\n",
|
|
273
|
-
"display(HTML(s))\n",
|
|
274
|
-
"\n",
|
|
275
|
-
"print('After display')"
|
|
276
|
-
]
|
|
277
|
-
},
|
|
278
|
-
{
|
|
279
|
-
"cell_type": "markdown",
|
|
280
|
-
"metadata": {},
|
|
281
|
-
"source": [
|
|
282
|
-
"## Markdown"
|
|
283
|
-
]
|
|
284
|
-
},
|
|
285
|
-
{
|
|
286
|
-
"cell_type": "code",
|
|
287
|
-
"execution_count": null,
|
|
288
|
-
"metadata": {
|
|
289
|
-
"trusted": true
|
|
290
|
-
},
|
|
291
|
-
"outputs": [],
|
|
292
|
-
"source": [
|
|
293
|
-
"Markdown('''\n",
|
|
294
|
-
"# Title\n",
|
|
295
|
-
"\n",
|
|
296
|
-
"**in bold**\n",
|
|
297
|
-
"\n",
|
|
298
|
-
"~~Strikthrough~~\n",
|
|
299
|
-
"''')"
|
|
300
|
-
]
|
|
301
|
-
},
|
|
302
|
-
{
|
|
303
|
-
"cell_type": "markdown",
|
|
304
|
-
"metadata": {},
|
|
305
|
-
"source": [
|
|
306
|
-
"## Pandas DataFrame"
|
|
307
|
-
]
|
|
308
|
-
},
|
|
309
|
-
{
|
|
310
|
-
"cell_type": "code",
|
|
311
|
-
"execution_count": null,
|
|
312
|
-
"metadata": {
|
|
313
|
-
"trusted": true
|
|
314
|
-
},
|
|
315
|
-
"outputs": [],
|
|
316
|
-
"source": [
|
|
317
|
-
"import pandas as pd\n",
|
|
318
|
-
"import numpy as np\n",
|
|
319
|
-
"from string import ascii_uppercase as letters\n",
|
|
320
|
-
"from IPython.display import display\n",
|
|
321
|
-
"\n",
|
|
322
|
-
"df = pd.DataFrame(np.random.randint(0, 100, size=(100, len(letters))), columns=list(letters))\n",
|
|
323
|
-
"df"
|
|
324
|
-
]
|
|
325
|
-
},
|
|
326
|
-
{
|
|
327
|
-
"cell_type": "markdown",
|
|
328
|
-
"metadata": {},
|
|
329
|
-
"source": [
|
|
330
|
-
"### Show the same DataFrame "
|
|
331
|
-
]
|
|
332
|
-
},
|
|
333
|
-
{
|
|
334
|
-
"cell_type": "code",
|
|
335
|
-
"execution_count": null,
|
|
336
|
-
"metadata": {
|
|
337
|
-
"trusted": true
|
|
338
|
-
},
|
|
339
|
-
"outputs": [],
|
|
340
|
-
"source": [
|
|
341
|
-
"df"
|
|
342
|
-
]
|
|
343
|
-
},
|
|
344
|
-
{
|
|
345
|
-
"cell_type": "markdown",
|
|
346
|
-
"metadata": {},
|
|
347
|
-
"source": [
|
|
348
|
-
"## IPython.display module"
|
|
349
|
-
]
|
|
350
|
-
},
|
|
351
|
-
{
|
|
352
|
-
"cell_type": "code",
|
|
353
|
-
"execution_count": null,
|
|
354
|
-
"metadata": {
|
|
355
|
-
"trusted": true
|
|
356
|
-
},
|
|
357
|
-
"outputs": [],
|
|
358
|
-
"source": [
|
|
359
|
-
"from IPython.display import clear_output, display, update_display\n",
|
|
360
|
-
"from asyncio import sleep"
|
|
361
|
-
]
|
|
362
|
-
},
|
|
363
|
-
{
|
|
364
|
-
"cell_type": "markdown",
|
|
365
|
-
"metadata": {},
|
|
366
|
-
"source": [
|
|
367
|
-
"### Update display"
|
|
368
|
-
]
|
|
369
|
-
},
|
|
370
|
-
{
|
|
371
|
-
"cell_type": "code",
|
|
372
|
-
"execution_count": null,
|
|
373
|
-
"metadata": {
|
|
374
|
-
"trusted": true
|
|
375
|
-
},
|
|
376
|
-
"outputs": [],
|
|
377
|
-
"source": [
|
|
378
|
-
"class Square:\n",
|
|
379
|
-
" color = 'PeachPuff'\n",
|
|
380
|
-
" def _repr_html_(self):\n",
|
|
381
|
-
" return '''\n",
|
|
382
|
-
" <div style=\"background: %s; width: 200px; height: 100px; border-radius: 10px;\">\n",
|
|
383
|
-
" </div>''' % self.color\n",
|
|
384
|
-
"square = Square()\n",
|
|
385
|
-
"\n",
|
|
386
|
-
"display(square, display_id='some-square')"
|
|
387
|
-
]
|
|
388
|
-
},
|
|
389
|
-
{
|
|
390
|
-
"cell_type": "code",
|
|
391
|
-
"execution_count": null,
|
|
392
|
-
"metadata": {
|
|
393
|
-
"trusted": true
|
|
394
|
-
},
|
|
395
|
-
"outputs": [],
|
|
396
|
-
"source": [
|
|
397
|
-
"square.color = 'OliveDrab'\n",
|
|
398
|
-
"update_display(square, display_id='some-square')"
|
|
399
|
-
]
|
|
400
|
-
},
|
|
401
|
-
{
|
|
402
|
-
"cell_type": "markdown",
|
|
403
|
-
"metadata": {},
|
|
404
|
-
"source": [
|
|
405
|
-
"### Clear output"
|
|
406
|
-
]
|
|
407
|
-
},
|
|
408
|
-
{
|
|
409
|
-
"cell_type": "code",
|
|
410
|
-
"execution_count": null,
|
|
411
|
-
"metadata": {
|
|
412
|
-
"trusted": true
|
|
413
|
-
},
|
|
414
|
-
"outputs": [],
|
|
415
|
-
"source": [
|
|
416
|
-
"print(\"hello\")\n",
|
|
417
|
-
"await sleep(3)\n",
|
|
418
|
-
"clear_output() # will flicker when replacing \"hello\" with \"goodbye\"\n",
|
|
419
|
-
"print(\"goodbye\")"
|
|
420
|
-
]
|
|
421
|
-
},
|
|
422
|
-
{
|
|
423
|
-
"cell_type": "code",
|
|
424
|
-
"execution_count": null,
|
|
425
|
-
"metadata": {
|
|
426
|
-
"trusted": true
|
|
427
|
-
},
|
|
428
|
-
"outputs": [],
|
|
429
|
-
"source": [
|
|
430
|
-
"print(\"hello\")\n",
|
|
431
|
-
"await sleep(3)\n",
|
|
432
|
-
"clear_output(wait=True) # prevents flickering\n",
|
|
433
|
-
"print(\"goodbye\")"
|
|
434
|
-
]
|
|
435
|
-
},
|
|
436
|
-
{
|
|
437
|
-
"cell_type": "markdown",
|
|
438
|
-
"metadata": {},
|
|
439
|
-
"source": [
|
|
440
|
-
"### Display classes"
|
|
441
|
-
]
|
|
442
|
-
},
|
|
443
|
-
{
|
|
444
|
-
"cell_type": "code",
|
|
445
|
-
"execution_count": null,
|
|
446
|
-
"metadata": {
|
|
447
|
-
"trusted": true
|
|
448
|
-
},
|
|
449
|
-
"outputs": [],
|
|
450
|
-
"source": [
|
|
451
|
-
"from IPython.display import HTML\n",
|
|
452
|
-
"HTML('''\n",
|
|
453
|
-
" <div style=\"background: aliceblue; width: 200px; height: 100px; border-radius: 10px;\">\n",
|
|
454
|
-
" </div>''')"
|
|
455
|
-
]
|
|
456
|
-
},
|
|
457
|
-
{
|
|
458
|
-
"cell_type": "code",
|
|
459
|
-
"execution_count": null,
|
|
460
|
-
"metadata": {
|
|
461
|
-
"trusted": true
|
|
462
|
-
},
|
|
463
|
-
"outputs": [],
|
|
464
|
-
"source": [
|
|
465
|
-
"from IPython.display import Math\n",
|
|
466
|
-
"Math(r'F(k) = \\int_{-\\infty}^{\\infty} f(x) e^{2\\pi i k} dx')"
|
|
467
|
-
]
|
|
468
|
-
},
|
|
469
|
-
{
|
|
470
|
-
"cell_type": "code",
|
|
471
|
-
"execution_count": null,
|
|
472
|
-
"metadata": {
|
|
473
|
-
"trusted": true
|
|
474
|
-
},
|
|
475
|
-
"outputs": [],
|
|
476
|
-
"source": [
|
|
477
|
-
"from IPython.display import Latex\n",
|
|
478
|
-
"Latex(r\"\"\"\\begin{eqnarray}\n",
|
|
479
|
-
"\\nabla \\times \\vec{\\mathbf{B}} -\\, \\frac1c\\, \\frac{\\partial\\vec{\\mathbf{E}}}{\\partial t} & = \\frac{4\\pi}{c}\\vec{\\mathbf{j}} \\\\\n",
|
|
480
|
-
"\\nabla \\cdot \\vec{\\mathbf{E}} & = 4 \\pi \\rho \\\\\n",
|
|
481
|
-
"\\nabla \\times \\vec{\\mathbf{E}}\\, +\\, \\frac1c\\, \\frac{\\partial\\vec{\\mathbf{B}}}{\\partial t} & = \\vec{\\mathbf{0}} \\\\\n",
|
|
482
|
-
"\\nabla \\cdot \\vec{\\mathbf{B}} & = 0 \n",
|
|
483
|
-
"\\end{eqnarray}\"\"\")"
|
|
484
|
-
]
|
|
485
|
-
},
|
|
486
|
-
{
|
|
487
|
-
"cell_type": "code",
|
|
488
|
-
"execution_count": null,
|
|
489
|
-
"metadata": {
|
|
490
|
-
"trusted": true
|
|
491
|
-
},
|
|
492
|
-
"outputs": [],
|
|
493
|
-
"source": [
|
|
494
|
-
"from IPython.display import ProgressBar\n",
|
|
495
|
-
"\n",
|
|
496
|
-
"for i in ProgressBar(10):\n",
|
|
497
|
-
" await sleep(0.1)"
|
|
498
|
-
]
|
|
499
|
-
},
|
|
500
|
-
{
|
|
501
|
-
"cell_type": "code",
|
|
502
|
-
"execution_count": null,
|
|
503
|
-
"metadata": {
|
|
504
|
-
"trusted": true
|
|
505
|
-
},
|
|
506
|
-
"outputs": [],
|
|
507
|
-
"source": [
|
|
508
|
-
"from IPython.display import JSON\n",
|
|
509
|
-
"JSON(['foo', {'bar': ('baz', None, 1.0, 2)}], metadata={}, expanded=True, root='test')"
|
|
510
|
-
]
|
|
511
|
-
},
|
|
512
|
-
{
|
|
513
|
-
"cell_type": "code",
|
|
514
|
-
"execution_count": null,
|
|
515
|
-
"metadata": {
|
|
516
|
-
"trusted": true
|
|
517
|
-
},
|
|
518
|
-
"outputs": [],
|
|
519
|
-
"source": [
|
|
520
|
-
"from IPython.display import GeoJSON\n",
|
|
521
|
-
"GeoJSON(\n",
|
|
522
|
-
" data={\n",
|
|
523
|
-
" \"type\": \"Feature\",\n",
|
|
524
|
-
" \"geometry\": {\n",
|
|
525
|
-
" \"type\": \"Point\",\n",
|
|
526
|
-
" \"coordinates\": [11.8, -45.04]\n",
|
|
527
|
-
" }\n",
|
|
528
|
-
" }, url_template=\"http://s3-eu-west-1.amazonaws.com/whereonmars.cartodb.net/{basemap_id}/{z}/{x}/{y}.png\",\n",
|
|
529
|
-
" layer_options={\n",
|
|
530
|
-
" \"basemap_id\": \"celestia_mars-shaded-16k_global\",\n",
|
|
531
|
-
" \"attribution\" : \"Celestia/praesepe\",\n",
|
|
532
|
-
" \"tms\": True,\n",
|
|
533
|
-
" \"minZoom\" : 0,\n",
|
|
534
|
-
" \"maxZoom\" : 5\n",
|
|
535
|
-
" }\n",
|
|
536
|
-
")"
|
|
537
|
-
]
|
|
538
|
-
},
|
|
539
|
-
{
|
|
540
|
-
"cell_type": "markdown",
|
|
541
|
-
"metadata": {},
|
|
542
|
-
"source": [
|
|
543
|
-
"## Network requests and JSON"
|
|
544
|
-
]
|
|
545
|
-
},
|
|
546
|
-
{
|
|
547
|
-
"cell_type": "code",
|
|
548
|
-
"execution_count": null,
|
|
549
|
-
"metadata": {
|
|
550
|
-
"trusted": true
|
|
551
|
-
},
|
|
552
|
-
"outputs": [],
|
|
553
|
-
"source": [
|
|
554
|
-
"import json\n",
|
|
555
|
-
"from js import fetch"
|
|
556
|
-
]
|
|
557
|
-
},
|
|
558
|
-
{
|
|
559
|
-
"cell_type": "code",
|
|
560
|
-
"execution_count": null,
|
|
561
|
-
"metadata": {
|
|
562
|
-
"trusted": true
|
|
563
|
-
},
|
|
564
|
-
"outputs": [],
|
|
565
|
-
"source": [
|
|
566
|
-
"res = await fetch('https://httpbin.org/get')\n",
|
|
567
|
-
"text = await res.text()\n",
|
|
568
|
-
"obj = json.loads(text) \n",
|
|
569
|
-
"JSON(obj)"
|
|
570
|
-
]
|
|
571
|
-
},
|
|
572
|
-
{
|
|
573
|
-
"cell_type": "markdown",
|
|
574
|
-
"metadata": {},
|
|
575
|
-
"source": [
|
|
576
|
-
"## Sympy"
|
|
577
|
-
]
|
|
578
|
-
},
|
|
579
|
-
{
|
|
580
|
-
"cell_type": "code",
|
|
581
|
-
"execution_count": null,
|
|
582
|
-
"metadata": {
|
|
583
|
-
"trusted": true
|
|
584
|
-
},
|
|
585
|
-
"outputs": [],
|
|
586
|
-
"source": [
|
|
587
|
-
"from sympy import Integral, sqrt, symbols, init_printing\n",
|
|
588
|
-
"\n",
|
|
589
|
-
"init_printing()\n",
|
|
590
|
-
"\n",
|
|
591
|
-
"x = symbols('x')\n",
|
|
592
|
-
"\n",
|
|
593
|
-
"Integral(sqrt(1 / x), x)"
|
|
594
|
-
]
|
|
595
|
-
},
|
|
596
|
-
{
|
|
597
|
-
"cell_type": "markdown",
|
|
598
|
-
"metadata": {},
|
|
599
|
-
"source": [
|
|
600
|
-
"## Magics"
|
|
601
|
-
]
|
|
602
|
-
},
|
|
603
|
-
{
|
|
604
|
-
"cell_type": "code",
|
|
605
|
-
"execution_count": null,
|
|
606
|
-
"metadata": {
|
|
607
|
-
"trusted": true
|
|
608
|
-
},
|
|
609
|
-
"outputs": [],
|
|
610
|
-
"source": [
|
|
611
|
-
"import os\n",
|
|
612
|
-
"os.listdir()"
|
|
613
|
-
]
|
|
614
|
-
},
|
|
615
|
-
{
|
|
616
|
-
"cell_type": "code",
|
|
617
|
-
"execution_count": null,
|
|
618
|
-
"metadata": {
|
|
619
|
-
"trusted": true
|
|
620
|
-
},
|
|
621
|
-
"outputs": [],
|
|
622
|
-
"source": [
|
|
623
|
-
"%cd /home"
|
|
624
|
-
]
|
|
625
|
-
},
|
|
626
|
-
{
|
|
627
|
-
"cell_type": "code",
|
|
628
|
-
"execution_count": null,
|
|
629
|
-
"metadata": {
|
|
630
|
-
"trusted": true
|
|
631
|
-
},
|
|
632
|
-
"outputs": [],
|
|
633
|
-
"source": [
|
|
634
|
-
"%pwd"
|
|
635
|
-
]
|
|
636
|
-
},
|
|
637
|
-
{
|
|
638
|
-
"cell_type": "code",
|
|
639
|
-
"execution_count": null,
|
|
640
|
-
"metadata": {
|
|
641
|
-
"trusted": true
|
|
642
|
-
},
|
|
643
|
-
"outputs": [],
|
|
644
|
-
"source": [
|
|
645
|
-
"current_path = %pwd\n",
|
|
646
|
-
"print(current_path)"
|
|
647
|
-
]
|
|
648
|
-
},
|
|
649
|
-
{
|
|
650
|
-
"cell_type": "code",
|
|
651
|
-
"execution_count": null,
|
|
652
|
-
"metadata": {
|
|
653
|
-
"trusted": true
|
|
654
|
-
},
|
|
655
|
-
"outputs": [],
|
|
656
|
-
"source": [
|
|
657
|
-
"%%writefile test.txt\n",
|
|
658
|
-
"\n",
|
|
659
|
-
"This will create a new file. \n",
|
|
660
|
-
"With the text that you see here."
|
|
661
|
-
]
|
|
662
|
-
},
|
|
663
|
-
{
|
|
664
|
-
"cell_type": "code",
|
|
665
|
-
"execution_count": null,
|
|
666
|
-
"metadata": {
|
|
667
|
-
"trusted": true
|
|
668
|
-
},
|
|
669
|
-
"outputs": [],
|
|
670
|
-
"source": [
|
|
671
|
-
"%history"
|
|
672
|
-
]
|
|
673
|
-
},
|
|
674
|
-
{
|
|
675
|
-
"cell_type": "code",
|
|
676
|
-
"execution_count": null,
|
|
677
|
-
"metadata": {
|
|
678
|
-
"trusted": true
|
|
679
|
-
},
|
|
680
|
-
"outputs": [],
|
|
681
|
-
"source": [
|
|
682
|
-
"import time"
|
|
683
|
-
]
|
|
684
|
-
},
|
|
685
|
-
{
|
|
686
|
-
"cell_type": "code",
|
|
687
|
-
"execution_count": null,
|
|
688
|
-
"metadata": {
|
|
689
|
-
"trusted": true
|
|
690
|
-
},
|
|
691
|
-
"outputs": [],
|
|
692
|
-
"source": [
|
|
693
|
-
"%%timeit \n",
|
|
694
|
-
"\n",
|
|
695
|
-
"time.sleep(0.1)"
|
|
696
|
-
]
|
|
697
|
-
}
|
|
698
|
-
],
|
|
699
|
-
"metadata": {
|
|
700
|
-
"kernelspec": {
|
|
701
|
-
"display_name": "Python (Pyodide)",
|
|
702
|
-
"language": "python",
|
|
703
|
-
"name": "python"
|
|
704
|
-
},
|
|
705
|
-
"language_info": {
|
|
706
|
-
"codemirror_mode": {
|
|
707
|
-
"name": "python",
|
|
708
|
-
"version": 3
|
|
709
|
-
},
|
|
710
|
-
"file_extension": ".py",
|
|
711
|
-
"mimetype": "text/x-python",
|
|
712
|
-
"name": "python",
|
|
713
|
-
"nbconvert_exporter": "python",
|
|
714
|
-
"pygments_lexer": "ipython3",
|
|
715
|
-
"version": "3.8"
|
|
716
|
-
},
|
|
717
|
-
"orig_nbformat": 4
|
|
718
|
-
},
|
|
719
|
-
"nbformat": 4,
|
|
720
|
-
"nbformat_minor": 4
|
|
721
|
-
}
|