Skip to content

Commit

Permalink
Move from black to ruff formatter (#697)
Browse files Browse the repository at this point in the history
  • Loading branch information
Hofer-Julian authored Oct 25, 2023
1 parent e21b854 commit 93984b3
Show file tree
Hide file tree
Showing 7 changed files with 7,480 additions and 8,715 deletions.
10 changes: 4 additions & 6 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,13 @@ repos:
exclude: '.teamcity'
- id: trailing-whitespace
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.0.291
rev: v0.1.2
hooks:
- id: ruff
types_or: [python, pyi, jupyter]
args: [--fix, --exit-non-zero-on-fix]
- repo: https://github.com/psf/black
rev: 23.9.1
hooks:
- id: black
- id: black-jupyter
- id: ruff-format
types_or: [python, pyi, jupyter]
- repo: https://github.com/kynan/nbstripout
rev: 0.6.1
hooks:
Expand Down
1 change: 0 additions & 1 deletion .vscode/extensions.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
"recommendations": [
"julialang.language-julia",
"ms-python.python",
"ms-python.black-formatter",
"ms-python.mypy-type-checker",
"charliermarsh.ruff",
"njpwerner.autodocstring"
Expand Down
2 changes: 1 addition & 1 deletion .vscode/settings_template.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"julia.environmentPath": "core",
"notebook.formatOnSave.enabled": true,
"[python]": {
"editor.defaultFormatter": "ms-python.black-formatter",
"editor.defaultFormatter": "charliermarsh.ruff",
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.fixAll": true
Expand Down
16 changes: 8 additions & 8 deletions docs/python/examples.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,12 @@
"metadata": {},
"outputs": [],
"source": [
"from pathlib import Path\n",
"\n",
"import geopandas as gpd\n",
"import matplotlib.pyplot as plt\n",
"import numpy as np\n",
"import pandas as pd\n",
"import matplotlib.pyplot as plt\n",
"from pathlib import Path\n",
"\n",
"import ribasim"
]
},
Expand Down Expand Up @@ -459,9 +459,8 @@
"source": [
"import numpy as np\n",
"import pandas as pd\n",
"import xarray as xr\n",
"\n",
"import ribasim"
"import ribasim\n",
"import xarray as xr"
]
},
{
Expand Down Expand Up @@ -1418,7 +1417,8 @@
"# Plot target level\n",
"target_levels = model.pid_control.time.target.to_numpy()[::2]\n",
"times = date2num(model.pid_control.time.time)[::2]\n",
"ax.plot(times, target_levels, color=\"k\", ls=\":\", label=\"target level\");"
"ax.plot(times, target_levels, color=\"k\", ls=\":\", label=\"target level\")\n",
"pass"
]
},
{
Expand All @@ -1445,7 +1445,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.12"
"version": "3.11.5"
}
},
"nbformat": 4,
Expand Down
Loading

0 comments on commit 93984b3

Please sign in to comment.