Skip to content

Commit d8f9407

Browse files
authored
Merge pull request #909 from minrk/magics-example
update magics tutorial
2 parents 8b47db8 + a754f4c commit d8f9407

File tree

17 files changed

+8484
-2707
lines changed

17 files changed

+8484
-2707
lines changed

.pre-commit-config.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,28 @@ repos:
1010
- "--fix"
1111
exclude_types:
1212
- jupyter
13+
- id: ruff
14+
name: ruff (notebooks)
15+
args:
16+
- "--fix"
17+
types:
18+
- jupyter
1319
- id: ruff-format
20+
# run via nbqa to handle cell magics
1421
exclude_types:
1522
- jupyter
1623
# run ruff via nbqa, which has better and configurable handling of cell magics
1724
# than ruff itself
25+
# but has trouble with isort rules
1826
- repo: https://github.com/nbQA-dev/nbQA
1927
rev: 1.9.0
2028
hooks:
2129
- id: nbqa-ruff-format
2230
- id: nbqa-ruff-check
2331
args:
2432
- --fix
33+
# isort rules get confused in the temporary files
34+
- --ignore=I
2535
- repo: https://github.com/pre-commit/mirrors-prettier
2636
rev: v4.0.0-alpha.8
2737
hooks:

docs/source/examples/Futures.ipynb

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -171,9 +171,7 @@
171171
{
172172
"cell_type": "code",
173173
"execution_count": 7,
174-
"metadata": {
175-
"scrolled": true
176-
},
174+
"metadata": {},
177175
"outputs": [
178176
{
179177
"data": {
@@ -416,7 +414,7 @@
416414
},
417415
"outputs": [],
418416
"source": [
419-
"def task(n):\n",
417+
"def interactive_task(n):\n",
420418
" \"\"\"Generates a 1xN array and computes its 2-norm\"\"\"\n",
421419
" import numpy\n",
422420
" from numpy.linalg import norm\n",
@@ -542,8 +540,8 @@
542540
}
543541
],
544542
"source": [
545-
"print(\"Local time:\")\n",
546-
"%time ref = list(map(task, sizes))"
543+
"%%time\n",
544+
"ref = list(map(task, sizes))"
547545
]
548546
},
549547
{

docs/source/examples/Monte Carlo Options.ipynb

Lines changed: 197 additions & 76 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)