-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
928ffc1
commit fe7b2c2
Showing
4 changed files
with
114 additions
and
0 deletions.
There are no files selected for viewing
41 changes: 41 additions & 0 deletions
41
crates/ruff/resources/test/fixtures/jupyter/line_magics.ipynb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "eab4754a-d6df-4b41-8ee8-7e23aef440f9", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"import math\n", | ||
"\n", | ||
"%matplotlib inline\n", | ||
"\n", | ||
"import os\n", | ||
"\n", | ||
"_ = math.pi" | ||
] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "Python (ruff)", | ||
"language": "python", | ||
"name": "ruff" | ||
}, | ||
"language_info": { | ||
"codemirror_mode": { | ||
"name": "ipython", | ||
"version": 3 | ||
}, | ||
"file_extension": ".py", | ||
"mimetype": "text/x-python", | ||
"name": "python", | ||
"nbconvert_exporter": "python", | ||
"pygments_lexer": "ipython3", | ||
"version": "3.11.3" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 5 | ||
} |
40 changes: 40 additions & 0 deletions
40
crates/ruff/resources/test/fixtures/jupyter/line_magics_expected.ipynb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "cad32845-44f9-4a53-8b8c-a6b1bb3f3378", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"import math\n", | ||
"\n", | ||
"%matplotlib inline\n", | ||
"\n", | ||
"\n", | ||
"_ = math.pi" | ||
] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "Python (ruff)", | ||
"language": "python", | ||
"name": "ruff" | ||
}, | ||
"language_info": { | ||
"codemirror_mode": { | ||
"name": "ipython", | ||
"version": 3 | ||
}, | ||
"file_extension": ".py", | ||
"mimetype": "text/x-python", | ||
"name": "python", | ||
"nbconvert_exporter": "python", | ||
"pygments_lexer": "ipython3", | ||
"version": "3.11.3" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 5 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
crates/ruff/src/jupyter/snapshots/ruff__jupyter__notebook__tests__line_magics.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
--- | ||
source: crates/ruff/src/jupyter/notebook.rs | ||
--- | ||
line_magics.ipynb:cell 1:5:8: F401 [*] `os` imported but unused | ||
| | ||
3 | %matplotlib inline | ||
4 | | ||
5 | import os | ||
| ^^ F401 | ||
| | ||
= help: Remove unused import: `os` | ||
|
||
ℹ Fix | ||
2 2 | | ||
3 3 | %matplotlib inline | ||
4 4 | | ||
5 |-import os | ||
6 5 | | ||
7 6 | _ = math.pi | ||
|
||
|