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

Move from black to ruff formatter #697

Merged
merged 3 commits into from
Oct 25, 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
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