Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add nbqa support support for example notebooks #3110

Merged
merged 7 commits into from
Jul 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
# activated pre-commit - https://github.com/pybamm-team/PyBaMM/pull/2272
0054efe388d2d17301f7e0554449eac9a7d3b7fc
# activated pre-commit for notebooks - https://github.com/pybamm-team/PyBaMM/pull/3110
a63e49ece0f9336d1f5c2562f7459e555c6e6693
arjxn-py marked this conversation as resolved.
Show resolved Hide resolved
7 changes: 7 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,10 @@ repos:
hooks:
- id: ruff
args: [--ignore=E741, --exclude=__init__.py]

- repo: https://github.com/nbQA-dev/nbQA
rev: 1.7.0
hooks:
- id: nbqa-ruff
additional_dependencies: [ruff==0.0.276]
args: ["--fix","--ignore=E501,E402"]
2 changes: 1 addition & 1 deletion docs/source/examples/notebooks/batch_study.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -516,7 +516,7 @@
"batch_study.solve(initial_soc=1)\n",
"\n",
"labels = [f\"Inner SEI open-circuit potential [V]: {inner_sei_oc_v}\" for inner_sei_oc_v in inner_sei_oc_v_values]\n",
"batch_study.plot(labels=labels)\n"
"batch_study.plot(labels=labels)"
]
},
{
Expand Down
2 changes: 1 addition & 1 deletion docs/source/examples/notebooks/callbacks.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@
],
"source": [
"callback = pybamm.callbacks.LoggingCallback(\"output.log\")\n",
"sim.solve(callbacks=callback);\n",
"sim.solve(callbacks=callback)\n",
"\n",
"# Read the file that has been written, which was saved to callback.logfile\n",
"with open(callback.logfile, \"r\") as f:\n",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,7 @@
"# plot\n",
"r = mesh[\"negative particle\"].nodes # radial position\n",
"\n",
"\n",
"def plot(t):\n",
" fig, (ax1, ax2) = plt.subplots(1, 2, figsize=(13, 4))\n",
" \n",
Expand All @@ -373,6 +374,7 @@
" plt.tight_layout()\n",
" plt.show()\n",
" \n",
"\n",
"import ipywidgets as widgets\n",
"widgets.interact(plot, t=widgets.FloatSlider(min=0,max=3600,step=1,value=0));\n",
" "
Expand Down
Loading
Loading