Skip to content

Commit

Permalink
chore: update Ruff config, lint notebooks (#901)
Browse files Browse the repository at this point in the history
Signed-off-by: Henry Schreiner <[email protected]>
  • Loading branch information
henryiii authored Nov 29, 2023
1 parent 316c917 commit a6efa1c
Show file tree
Hide file tree
Showing 8 changed files with 47 additions and 38 deletions.
1 change: 1 addition & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ repos:
hooks:
- id: ruff
args: ["--fix", "--show-fixes"]
types_or: [python, pyi, jupyter]
- id: ruff-format
types_or: [python, pyi, jupyter]

Expand Down
10 changes: 6 additions & 4 deletions notebooks/BoostHistogramHandsOn.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,13 @@
"metadata": {},
"outputs": [],
"source": [
"import boost_histogram as bh\n",
"import numpy as np\n",
"import matplotlib.pyplot as plt\n",
"import functools\n",
"import operator"
"import operator\n",
"\n",
"import matplotlib.pyplot as plt\n",
"import numpy as np\n",
"\n",
"import boost_histogram as bh"
]
},
{
Expand Down
5 changes: 3 additions & 2 deletions notebooks/PerformanceComparison.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,10 @@
"metadata": {},
"outputs": [],
"source": [
"import boost_histogram as bh\n",
"import numpy as np\n",
"from numpy.testing import assert_allclose"
"from numpy.testing import assert_allclose\n",
"\n",
"import boost_histogram as bh"
]
},
{
Expand Down
5 changes: 3 additions & 2 deletions notebooks/SimpleExample.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@
"metadata": {},
"outputs": [],
"source": [
"import boost_histogram as bh\n",
"import numpy as np"
"import numpy as np\n",
"\n",
"import boost_histogram as bh"
]
},
{
Expand Down
8 changes: 5 additions & 3 deletions notebooks/ThreadedFills.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,14 @@
"metadata": {},
"outputs": [],
"source": [
"import numpy as np\n",
"import boost_histogram as bh\n",
"from concurrent.futures import ThreadPoolExecutor\n",
"from functools import reduce\n",
"from operator import add\n",
"from numpy.testing import assert_array_equal"
"\n",
"import numpy as np\n",
"from numpy.testing import assert_array_equal\n",
"\n",
"import boost_histogram as bh"
]
},
{
Expand Down
20 changes: 12 additions & 8 deletions notebooks/aghast.ipynb

Large diffs are not rendered by default.

20 changes: 10 additions & 10 deletions notebooks/xarray.ipynb

Large diffs are not rendered by default.

16 changes: 7 additions & 9 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -146,18 +146,13 @@ extend-select = [
"YTT", # flake8-2020
]
ignore = [
"PLR", # Design related pylint codes
"E501", # Line too long
"PLR09", # Too many X
"PLR2004", # Magic value in comparison
"E501", # Line too long
"PT011", "PT013", # Incorrect pytest codes
"ISC001", # Conflicts with the formatter
"ISC001", # Conflicts with the formatter
]
unfixable = [
"T20", # Removes print statements
"F841", # Removes unused variables
]
exclude = []
typing-modules = ["boost_histogram._internal.typing"]
flake8-unused-arguments.ignore-variadic-names = true
isort.required-imports = ["from __future__ import annotations"]


Expand All @@ -174,3 +169,6 @@ max-complexity = 13
"notebooks/*" = ["T20"]
"*.pyi" = ["F401", "F811", "ARG001"]
"docs/conf.py" = ["E402", "ARG001"]
# Several of these will be fixed in the next Ruff release
# F401 is needed since Ruff doesn't realise some magics are code
"**.ipynb" = ["E703", "I002", "E731", "B015", "B018", "F401"]

0 comments on commit a6efa1c

Please sign in to comment.