[pre-commit.ci] pre-commit autoupdate (#2959)

* [pre-commit.ci] pre-commit autoupdate

updates:
- [github.com/astral-sh/ruff-pre-commit: c59bba8fb259db0fec2bbb77ad8ba51ea7341b56 → 39d9ac5938dadb73df0564a45f163e25ff9fa6e2](https://github.com/astral-sh/ruff-pre-commit/compare/c59bba8fb259db0fec2bbb77ad8ba51ea7341b56...39d9ac5938dadb73df0564a45f163e25ff9fa6e2)
- [github.com/pre-commit/mirrors-mypy: d2823d321df3af8f878f7ee3414dc94d037145b9 → 41e691678310dfd3833f7ab4e180ddb014310356](https://github.com/pre-commit/mirrors-mypy/compare/d2823d321df3af8f878f7ee3414dc94d037145b9...41e691678310dfd3833f7ab4e180ddb014310356)
- [github.com/codespell-project/codespell: 2ccb47ff45ad361a21071a7eedda4c37e6ae8c5a → 57b21406f092110c18776e39b0bda50d37c945c8](https://github.com/codespell-project/codespell/compare/2ccb47ff45ad361a21071a7eedda4c37e6ae8c5a...57b21406f092110c18776e39b0bda50d37c945c8)

* chore: fix lint errors from new ruff rules

Ruff 0.16 enables BLE, TRY, and N999 by default. Use local noqa
excludes for the blind-except catches, ignore TRY002 and N999 in tests,
and drop the pylint equivalents.

Assisted-by: ClaudeCode:claude-opus-5

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Henry Schreiner <henryfs@princeton.edu>
This commit is contained in:
pre-commit-ci[bot]
2026-08-11 17:42:16 -04:00
committed by GitHub
co-authored by pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Henry Schreiner
parent 1928c1bfa5
commit 10c055d89c
6 changed files with 10 additions and 8 deletions
+3 -3
View File
@@ -18,14 +18,14 @@ repos:
exclude: ^cibuildwheel/resources/android/android.patch$
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: c59bba8fb259db0fec2bbb77ad8ba51ea7341b56 # frozen: v0.15.20
rev: 39d9ac5938dadb73df0564a45f163e25ff9fa6e2 # frozen: v0.16.1
hooks:
- id: ruff-check
args: ["--fix"]
- id: ruff-format
- repo: https://github.com/pre-commit/mirrors-mypy
rev: d2823d321df3af8f878f7ee3414dc94d037145b9 # frozen: v2.1.0
rev: 41e691678310dfd3833f7ab4e180ddb014310356 # frozen: v2.3.0
hooks:
- id: mypy
name: mypy 3.11 on cibuildwheel/
@@ -85,7 +85,7 @@ repos:
exclude: "^cibuildwheel/resources/"
- repo: https://github.com/codespell-project/codespell
rev: 2ccb47ff45ad361a21071a7eedda4c37e6ae8c5a # frozen: v2.4.2
rev: 57b21406f092110c18776e39b0bda50d37c945c8 # frozen: v2.4.3
hooks:
- id: codespell
args: ["-w"]
+1 -1
View File
@@ -49,7 +49,7 @@ def parse(contents: str) -> str | None:
analyzer = Analyzer()
analyzer.visit(tree)
return analyzer.requires_python or ""
except Exception:
except Exception: # noqa: BLE001
return None
+1 -1
View File
@@ -83,7 +83,7 @@ def github_api_request(path: str, *, max_retries: int = 3) -> dict[str, Any]:
if retry_count == max_retries - 1:
print(f"GitHub API request failed (Network error: {e}). Check network connection.")
raise e
raise
# Should never be reached but to keep the type checker happy
msg = "Unexpected execution path in github_api_request"
+1 -1
View File
@@ -68,7 +68,7 @@ def setup_py_python_requires(content: str) -> str | None:
analyzer = Analyzer()
analyzer.visit(tree)
return analyzer.requires_python or None
except Exception: # pylint: disable=broad-except
except Exception: # noqa: BLE001
return None
+1 -1
View File
@@ -53,7 +53,7 @@ def remove_on_error(path: Path) -> Generator[None, None, None]:
shutil.rmtree(path)
elif path.exists() or path.is_symlink():
path.unlink()
except BaseException as cleanup_exception:
except BaseException as cleanup_exception: # noqa: BLE001
msg = f"Failed to remove {path}. Please remove it manually."
raise BaseExceptionGroup(msg, [original_exception, cleanup_exception]) from None
raise
+3 -1
View File
@@ -166,6 +166,7 @@ messages_control.disable = [
"wrong-import-position",
"unused-argument", # Handled by Ruff
"import-outside-toplevel", # Handled by Ruff
"broad-exception-caught", # Handled by Ruff
"broad-exception-raised", # Could be improved eventually
"consider-using-in", # MyPy can't narrow "in"
]
@@ -217,6 +218,7 @@ ignore = [
"PT007", # Lists of tuples in Pytest
"PYI025", # Set as AbstractSet
"PTH123", # open -> Path.open
"TRY002", # Create your own exception
]
flake8-unused-arguments.ignore-variadic-names = true
flake8-tidy-imports.ban-relative-imports = "all"
@@ -234,7 +236,7 @@ future-annotations = true
[tool.ruff.lint.per-file-ignores]
"unit_test/*" = ["PLC1901", "TID252"]
"test/*" = ["TID252"]
"test/*" = ["TID252", "N999"]
"bin/*" = ["TID251"]
"cibuildwheel/resources/install_certifi.py" = ["PTH"]