Browse Source

chore(deps): update pre-commit hooks (#5605)

* chore(deps): update pre-commit hooks

updates:
- [github.com/pre-commit/mirrors-clang-format: v19.1.7 → v20.1.0](https://github.com/pre-commit/mirrors-clang-format/compare/v19.1.7...v20.1.0)
- [github.com/astral-sh/ruff-pre-commit: v0.9.9 → v0.11.4](https://github.com/astral-sh/ruff-pre-commit/compare/v0.9.9...v0.11.4)
- [github.com/PyCQA/pylint: v3.3.4 → v3.3.6](https://github.com/PyCQA/pylint/compare/v3.3.4...v3.3.6)
- [github.com/python-jsonschema/check-jsonschema: 0.31.2 → 0.32.1](https://github.com/python-jsonschema/check-jsonschema/compare/0.31.2...0.32.1)

* style: pre-commit fixes

* Update setup.py

* Update tests/test_enum.py

* Update configure.yml

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Henry Schreiner <HenrySchreinerIII@gmail.com>
pull/5539/head
pre-commit-ci[bot] 3 months ago committed by GitHub
parent
commit
a2951abbec
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 6
      .github/workflows/configure.yml
  2. 8
      .pre-commit-config.yaml
  3. 10
      include/pybind11/pybind11.h
  4. 2
      setup.py
  5. 4
      tests/test_buffers.cpp
  6. 16
      tests/test_enum.py
  7. 2
      tests/test_opaque_types.cpp

6
.github/workflows/configure.yml

@ -24,16 +24,16 @@ jobs: @@ -24,16 +24,16 @@ jobs:
strategy:
fail-fast: false
matrix:
runs-on: [ubuntu-20.04, macos-13, windows-latest]
runs-on: [ubuntu-22.04, macos-13, windows-latest]
arch: [x64]
cmake: ["3.26"]
include:
- runs-on: ubuntu-20.04
- runs-on: ubuntu-22.04
arch: x64
cmake: "3.15"
- runs-on: ubuntu-20.04
- runs-on: ubuntu-22.04
arch: x64
cmake: "3.29"

8
.pre-commit-config.yaml

@ -25,14 +25,14 @@ repos: @@ -25,14 +25,14 @@ repos:
# Clang format the codebase automatically
- repo: https://github.com/pre-commit/mirrors-clang-format
rev: "v19.1.7"
rev: "v20.1.0"
hooks:
- id: clang-format
types_or: [c++, c, cuda]
# Ruff, the Python auto-correcting linter/formatter written in Rust
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.9.9
rev: v0.11.4
hooks:
- id: ruff
args: ["--fix", "--show-fixes"]
@ -144,14 +144,14 @@ repos: @@ -144,14 +144,14 @@ repos:
# PyLint has native support - not always usable, but works for us
- repo: https://github.com/PyCQA/pylint
rev: "v3.3.4"
rev: "v3.3.6"
hooks:
- id: pylint
files: ^pybind11
# Check schemas on some of our YAML files
- repo: https://github.com/python-jsonschema/check-jsonschema
rev: 0.31.2
rev: 0.32.1
hooks:
- id: check-readthedocs
- id: check-github-workflows

10
include/pybind11/pybind11.h

@ -277,7 +277,7 @@ public: @@ -277,7 +277,7 @@ public:
cpp_function(Return (Class::*f)(Arg...), const Extra &...extra) {
initialize(
[f](Class *c, Arg... args) -> Return { return (c->*f)(std::forward<Arg>(args)...); },
(Return(*)(Class *, Arg...)) nullptr,
(Return (*)(Class *, Arg...)) nullptr,
extra...);
}
@ -289,7 +289,7 @@ public: @@ -289,7 +289,7 @@ public:
cpp_function(Return (Class::*f)(Arg...) &, const Extra &...extra) {
initialize(
[f](Class *c, Arg... args) -> Return { return (c->*f)(std::forward<Arg>(args)...); },
(Return(*)(Class *, Arg...)) nullptr,
(Return (*)(Class *, Arg...)) nullptr,
extra...);
}
@ -299,7 +299,7 @@ public: @@ -299,7 +299,7 @@ public:
cpp_function(Return (Class::*f)(Arg...) const, const Extra &...extra) {
initialize([f](const Class *c,
Arg... args) -> Return { return (c->*f)(std::forward<Arg>(args)...); },
(Return(*)(const Class *, Arg...)) nullptr,
(Return (*)(const Class *, Arg...)) nullptr,
extra...);
}
@ -311,7 +311,7 @@ public: @@ -311,7 +311,7 @@ public:
cpp_function(Return (Class::*f)(Arg...) const &, const Extra &...extra) {
initialize([f](const Class *c,
Arg... args) -> Return { return (c->*f)(std::forward<Arg>(args)...); },
(Return(*)(const Class *, Arg...)) nullptr,
(Return (*)(const Class *, Arg...)) nullptr,
extra...);
}
@ -874,7 +874,7 @@ protected: @@ -874,7 +874,7 @@ protected:
function_call call(func, parent);
// Protect std::min with parentheses
size_t args_to_copy = (std::min)(pos_args, n_args_in);
size_t args_to_copy = (std::min) (pos_args, n_args_in);
size_t args_copied = 0;
// 0. Inject new-style `self` argument

2
setup.py

@ -51,7 +51,7 @@ def build_expected_version_hex(matches: dict[str, str]) -> str: @@ -51,7 +51,7 @@ def build_expected_version_hex(matches: dict[str, str]) -> str:
# PYBIND11_GLOBAL_SDIST will build a different sdist, with the python-headers
# files, and the sys.prefix files (CMake and headers).
global_sdist = os.environ.get("PYBIND11_GLOBAL_SDIST", False)
global_sdist = os.environ.get("PYBIND11_GLOBAL_SDIST")
setup_py = Path(
"tools/setup_global.py.in" if global_sdist else "tools/setup_main.py.in"

4
tests/test_buffers.cpp

@ -237,11 +237,11 @@ TEST_SUBMODULE(buffers, m) { @@ -237,11 +237,11 @@ TEST_SUBMODULE(buffers, m) {
}
float operator()(py::ssize_t i, py::ssize_t j) const {
return Matrix::operator()(i * m_row_factor, j * m_col_factor);
return Matrix::operator()(i *m_row_factor, j *m_col_factor);
}
float &operator()(py::ssize_t i, py::ssize_t j) {
return Matrix::operator()(i * m_row_factor, j * m_col_factor);
return Matrix::operator()(i *m_row_factor, j *m_col_factor);
}
using Matrix::data;

16
tests/test_enum.py

@ -59,15 +59,13 @@ def test_unscoped_enum(): @@ -59,15 +59,13 @@ def test_unscoped_enum():
"EThree": m.UnscopedEnum.EThree,
}
for docstring_line in """An unscoped enumeration
Members:
EOne : Docstring for EOne
ETwo : Docstring for ETwo
EThree : Docstring for EThree""".split("\n"):
for docstring_line in [
"An unscoped enumeration",
"Members:",
" EOne : Docstring for EOne",
" ETwo : Docstring for ETwo",
" EThree : Docstring for EThree",
]:
assert docstring_line in m.UnscopedEnum.__doc__
# Unscoped enums will accept ==/!= int comparisons

2
tests/test_opaque_types.cpp

@ -28,7 +28,7 @@ TEST_SUBMODULE(opaque_types, m) { @@ -28,7 +28,7 @@ TEST_SUBMODULE(opaque_types, m) {
.def(py::init<>())
.def("pop_back", &StringList::pop_back)
/* There are multiple versions of push_back(), etc. Select the right ones. */
.def("push_back", (void(StringList::*)(const std::string &)) & StringList::push_back)
.def("push_back", (void (StringList::*)(const std::string &)) &StringList::push_back)
.def("back", (std::string & (StringList::*) ()) & StringList::back)
.def("__len__", [](const StringList &v) { return v.size(); })
.def(

Loading…
Cancel
Save