Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit ca52406

Browse files
committed
MNT: Update all pre-commit hooks
When we moved off the app to running in Actions, we lost the auto update and things fell behind. Now set up Dependabot to automate these like everything else. Also bump the minimum mypy, as such old versions no longer work.
1 parent 1068992 commit ca52406

18 files changed

Lines changed: 33 additions & 32 deletions

.github/dependabot.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,7 @@ updates:
1515
interval: "weekly"
1616
exclude-paths:
1717
- "ci/minver-requirements.txt"
18+
- package-ecosystem: "pre-commit"
19+
directory: "/"
20+
schedule:
21+
interval: "monthly"

.github/workflows/linting.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
python-version: "3.x"
2121
- uses: j178/prek-action@cbc2f23eb5539cf20d82d1aabd0d0ecbcc56f4e3 # v2.0.2
2222
with:
23-
extra_args: --hook-stage manual --all-files
23+
extra-args: --hook-stage manual --all-files
2424

2525
ruff:
2626
name: ruff

.pre-commit-config.yaml

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ exclude: |
1515
)
1616
repos:
1717
- repo: https://github.com/pre-commit/pre-commit-hooks
18-
rev: v5.0.0
18+
rev: 3e8a8703264a2f4a69428a0aa4dcb512790b2c8c # frozen: v6.0.0
1919
hooks:
2020
- id: check-added-large-files
2121
- id: check-docstring-first
@@ -29,7 +29,7 @@ repos:
2929
- id: trailing-whitespace
3030
exclude_types: [diff, svg]
3131
- repo: https://github.com/pre-commit/mirrors-mypy
32-
rev: v1.15.0
32+
rev: 0f369d245750787ce34997d464ed9605391a5283 # frozen: v1.20.1
3333
hooks:
3434
- id: mypy
3535
additional_dependencies:
@@ -42,16 +42,15 @@ repos:
4242
args: ["--config-file=pyproject.toml", "lib/matplotlib"]
4343
files: lib/matplotlib # Only run when files in lib/matplotlib are changed.
4444
pass_filenames: false
45-
4645
- repo: https://github.com/astral-sh/ruff-pre-commit
4746
# Ruff version.
48-
rev: v0.15.11
47+
rev: d1b833175a5d08a925900115526febd8fe71c98e # frozen: v0.15.11
4948
hooks:
5049
# Run the linter.
51-
- id: ruff
50+
- id: ruff-check
5251
args: [--fix, --show-fixes]
5352
- repo: https://github.com/codespell-project/codespell
54-
rev: v2.4.1
53+
rev: 2ccb47ff45ad361a21071a7eedda4c37e6ae8c5a # frozen: v2.4.2
5554
hooks:
5655
- id: codespell
5756
files: ^.*\.(py|c|cpp|h|m|md|rst|yml)$
@@ -61,25 +60,25 @@ repos:
6160
- "--skip"
6261
- "doc/project/credits.rst"
6362
- repo: https://github.com/pycqa/isort
64-
rev: 6.0.1
63+
rev: a333737ed43df02b18e6c95477ea1b285b3de15a # frozen: 8.0.1
6564
hooks:
6665
- id: isort
6766
name: isort (python)
6867
files: ^galleries/tutorials/|^galleries/examples/|^galleries/plot_types/
6968
- repo: https://github.com/rstcheck/rstcheck
70-
rev: v6.2.4
69+
rev: 77490ffa33bfc0928975ae3cf904219903db755d # frozen: v6.2.5
7170
hooks:
7271
- id: rstcheck
7372
additional_dependencies:
7473
- sphinx>=1.8.1
7574
- tomli
7675
- repo: https://github.com/adrienverge/yamllint
77-
rev: v1.37.0
76+
rev: cba56bcde1fdd01c1deb3f945e69764c291a6530 # frozen: v1.38.0
7877
hooks:
7978
- id: yamllint
8079
args: ["--strict", "--config-file=.yamllint.yml"]
8180
- repo: https://github.com/python-jsonschema/check-jsonschema
82-
rev: 0.33.0
81+
rev: 13614ab716a3113145f1294ed259d9fbe5678ff3 # frozen: 0.37.1
8382
hooks:
8483
# TODO: Re-enable this when https://github.com/microsoft/azure-pipelines-vscode/issues/567 is fixed.
8584
# - id: check-azure-pipelines

lib/matplotlib/_docstring.pyi

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ class Substitution:
1414
@overload
1515
def __init__(self, **kwargs: str): ...
1616
def __call__(self, func: _T) -> _T: ...
17-
def update(self, *args, **kwargs): ... # type: ignore[no-untyped-def]
1817

1918

2019
class _ArtistKwdocLoader(dict[str, str]):

lib/matplotlib/colors.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -445,7 +445,7 @@ class MultiNorm(Norm):
445445
def __call__(self, values: tuple[float, ...], clip: ArrayLike | bool | None = ...) -> tuple[float, ...]: ...
446446
@overload
447447
def __call__(self, values: ArrayLike, clip: ArrayLike | bool | None = ...) -> tuple: ...
448-
def inverse(self, values: ArrayLike) -> tuple: ... # type: ignore[override]
448+
def inverse(self, values: ArrayLike) -> tuple: ...
449449
def autoscale(self, A: ArrayLike) -> None: ...
450450
def autoscale_None(self, A: ArrayLike) -> None: ...
451451
def scaled(self) -> bool: ...

lib/matplotlib/pyplot.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -870,7 +870,7 @@ def xkcd(
870870
"xkcd mode is not compatible with text.usetex = True")
871871

872872
stack = ExitStack()
873-
stack.callback(rcParams._update_raw, rcParams.copy()) # type: ignore[arg-type]
873+
stack.callback(rcParams._update_raw, rcParams.copy())
874874

875875
from matplotlib import patheffects
876876
rcParams.update({
@@ -1077,8 +1077,7 @@ def figure(
10771077
else:
10781078
num = int(num) # crude validation of num argument
10791079

1080-
# Type of "num" has narrowed to int, but mypy can't quite see it
1081-
manager = _pylab_helpers.Gcf.get_fig_manager(num) # type: ignore[arg-type]
1080+
manager = _pylab_helpers.Gcf.get_fig_manager(num)
10821081
if manager is None:
10831082
max_open_warning = rcParams['figure.max_open_warning']
10841083
if len(allnums) == max_open_warning >= 1:
@@ -1467,7 +1466,7 @@ def sca(ax: Axes) -> None:
14671466
# but if you are calling this, it won't be None
14681467
# Additionally the slight difference between `Figure` and `FigureBase` mypy catches
14691468
fig = ax.get_figure(root=False)
1470-
figure(fig) # type: ignore[arg-type]
1469+
figure(fig)
14711470
fig.sca(ax) # type: ignore[union-attr]
14721471

14731472

lib/matplotlib/tests/test__style_helpers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import pytest
22

33
import matplotlib.colors as mcolors
4-
from matplotlib.lines import _get_dash_pattern
4+
from matplotlib.lines import _get_dash_pattern # type: ignore[attr-defined]
55
from matplotlib._style_helpers import style_generator
66

77

lib/matplotlib/tests/test_axes.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
import matplotlib.text as mtext
4141
import matplotlib.ticker as mticker
4242
import matplotlib.transforms as mtransforms
43-
import mpl_toolkits.axisartist as AA # type: ignore[import]
43+
import mpl_toolkits.axisartist as AA
4444
from numpy.testing import (
4545
assert_allclose, assert_array_equal, assert_array_almost_equal)
4646
from matplotlib.testing.decorators import (

lib/matplotlib/tests/test_backends_interactive.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ def _get_available_interactive_backends():
8989
reason = "macosx backend fails on Azure"
9090
elif env["MPLBACKEND"].startswith('gtk'):
9191
try:
92-
import gi # type: ignore[import]
92+
import gi
9393
except ImportError:
9494
# Though we check that `gi` exists above, it is possible that its
9595
# C-level dependencies are not available, and then it still raises an

lib/matplotlib/tests/test_basic.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ def test_simple():
1111

1212

1313
def test_override_builtins():
14-
import pylab # type: ignore[import]
14+
import pylab
1515
ok_to_override = {
1616
'__name__',
1717
'__doc__',

0 commit comments

Comments
 (0)