mirror of
https://github.com/pybind/pybind11.git
synced 2026-03-14 20:27:47 +00:00
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>
This commit is contained in:
committed by
GitHub
parent
d25e91fb8f
commit
a2951abbec
6
.github/workflows/configure.yml
vendored
6
.github/workflows/configure.yml
vendored
@@ -24,16 +24,16 @@ jobs:
|
|||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
runs-on: [ubuntu-20.04, macos-13, windows-latest]
|
runs-on: [ubuntu-22.04, macos-13, windows-latest]
|
||||||
arch: [x64]
|
arch: [x64]
|
||||||
cmake: ["3.26"]
|
cmake: ["3.26"]
|
||||||
|
|
||||||
include:
|
include:
|
||||||
- runs-on: ubuntu-20.04
|
- runs-on: ubuntu-22.04
|
||||||
arch: x64
|
arch: x64
|
||||||
cmake: "3.15"
|
cmake: "3.15"
|
||||||
|
|
||||||
- runs-on: ubuntu-20.04
|
- runs-on: ubuntu-22.04
|
||||||
arch: x64
|
arch: x64
|
||||||
cmake: "3.29"
|
cmake: "3.29"
|
||||||
|
|
||||||
|
|||||||
@@ -25,14 +25,14 @@ repos:
|
|||||||
|
|
||||||
# Clang format the codebase automatically
|
# Clang format the codebase automatically
|
||||||
- repo: https://github.com/pre-commit/mirrors-clang-format
|
- repo: https://github.com/pre-commit/mirrors-clang-format
|
||||||
rev: "v19.1.7"
|
rev: "v20.1.0"
|
||||||
hooks:
|
hooks:
|
||||||
- id: clang-format
|
- id: clang-format
|
||||||
types_or: [c++, c, cuda]
|
types_or: [c++, c, cuda]
|
||||||
|
|
||||||
# Ruff, the Python auto-correcting linter/formatter written in Rust
|
# Ruff, the Python auto-correcting linter/formatter written in Rust
|
||||||
- repo: https://github.com/astral-sh/ruff-pre-commit
|
- repo: https://github.com/astral-sh/ruff-pre-commit
|
||||||
rev: v0.9.9
|
rev: v0.11.4
|
||||||
hooks:
|
hooks:
|
||||||
- id: ruff
|
- id: ruff
|
||||||
args: ["--fix", "--show-fixes"]
|
args: ["--fix", "--show-fixes"]
|
||||||
@@ -144,14 +144,14 @@ repos:
|
|||||||
|
|
||||||
# PyLint has native support - not always usable, but works for us
|
# PyLint has native support - not always usable, but works for us
|
||||||
- repo: https://github.com/PyCQA/pylint
|
- repo: https://github.com/PyCQA/pylint
|
||||||
rev: "v3.3.4"
|
rev: "v3.3.6"
|
||||||
hooks:
|
hooks:
|
||||||
- id: pylint
|
- id: pylint
|
||||||
files: ^pybind11
|
files: ^pybind11
|
||||||
|
|
||||||
# Check schemas on some of our YAML files
|
# Check schemas on some of our YAML files
|
||||||
- repo: https://github.com/python-jsonschema/check-jsonschema
|
- repo: https://github.com/python-jsonschema/check-jsonschema
|
||||||
rev: 0.31.2
|
rev: 0.32.1
|
||||||
hooks:
|
hooks:
|
||||||
- id: check-readthedocs
|
- id: check-readthedocs
|
||||||
- id: check-github-workflows
|
- id: check-github-workflows
|
||||||
|
|||||||
@@ -277,7 +277,7 @@ public:
|
|||||||
cpp_function(Return (Class::*f)(Arg...), const Extra &...extra) {
|
cpp_function(Return (Class::*f)(Arg...), const Extra &...extra) {
|
||||||
initialize(
|
initialize(
|
||||||
[f](Class *c, Arg... args) -> Return { return (c->*f)(std::forward<Arg>(args)...); },
|
[f](Class *c, Arg... args) -> Return { return (c->*f)(std::forward<Arg>(args)...); },
|
||||||
(Return(*)(Class *, Arg...)) nullptr,
|
(Return (*)(Class *, Arg...)) nullptr,
|
||||||
extra...);
|
extra...);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -289,7 +289,7 @@ public:
|
|||||||
cpp_function(Return (Class::*f)(Arg...) &, const Extra &...extra) {
|
cpp_function(Return (Class::*f)(Arg...) &, const Extra &...extra) {
|
||||||
initialize(
|
initialize(
|
||||||
[f](Class *c, Arg... args) -> Return { return (c->*f)(std::forward<Arg>(args)...); },
|
[f](Class *c, Arg... args) -> Return { return (c->*f)(std::forward<Arg>(args)...); },
|
||||||
(Return(*)(Class *, Arg...)) nullptr,
|
(Return (*)(Class *, Arg...)) nullptr,
|
||||||
extra...);
|
extra...);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -299,7 +299,7 @@ public:
|
|||||||
cpp_function(Return (Class::*f)(Arg...) const, const Extra &...extra) {
|
cpp_function(Return (Class::*f)(Arg...) const, const Extra &...extra) {
|
||||||
initialize([f](const Class *c,
|
initialize([f](const Class *c,
|
||||||
Arg... args) -> Return { return (c->*f)(std::forward<Arg>(args)...); },
|
Arg... args) -> Return { return (c->*f)(std::forward<Arg>(args)...); },
|
||||||
(Return(*)(const Class *, Arg...)) nullptr,
|
(Return (*)(const Class *, Arg...)) nullptr,
|
||||||
extra...);
|
extra...);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -311,7 +311,7 @@ public:
|
|||||||
cpp_function(Return (Class::*f)(Arg...) const &, const Extra &...extra) {
|
cpp_function(Return (Class::*f)(Arg...) const &, const Extra &...extra) {
|
||||||
initialize([f](const Class *c,
|
initialize([f](const Class *c,
|
||||||
Arg... args) -> Return { return (c->*f)(std::forward<Arg>(args)...); },
|
Arg... args) -> Return { return (c->*f)(std::forward<Arg>(args)...); },
|
||||||
(Return(*)(const Class *, Arg...)) nullptr,
|
(Return (*)(const Class *, Arg...)) nullptr,
|
||||||
extra...);
|
extra...);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -874,7 +874,7 @@ protected:
|
|||||||
function_call call(func, parent);
|
function_call call(func, parent);
|
||||||
|
|
||||||
// Protect std::min with parentheses
|
// 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;
|
size_t args_copied = 0;
|
||||||
|
|
||||||
// 0. Inject new-style `self` argument
|
// 0. Inject new-style `self` argument
|
||||||
|
|||||||
2
setup.py
2
setup.py
@@ -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
|
# PYBIND11_GLOBAL_SDIST will build a different sdist, with the python-headers
|
||||||
# files, and the sys.prefix files (CMake and 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(
|
setup_py = Path(
|
||||||
"tools/setup_global.py.in" if global_sdist else "tools/setup_main.py.in"
|
"tools/setup_global.py.in" if global_sdist else "tools/setup_main.py.in"
|
||||||
|
|||||||
@@ -237,11 +237,11 @@ TEST_SUBMODULE(buffers, m) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
float operator()(py::ssize_t i, py::ssize_t j) const {
|
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) {
|
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;
|
using Matrix::data;
|
||||||
|
|||||||
@@ -59,15 +59,13 @@ def test_unscoped_enum():
|
|||||||
"EThree": m.UnscopedEnum.EThree,
|
"EThree": m.UnscopedEnum.EThree,
|
||||||
}
|
}
|
||||||
|
|
||||||
for docstring_line in """An unscoped enumeration
|
for docstring_line in [
|
||||||
|
"An unscoped enumeration",
|
||||||
Members:
|
"Members:",
|
||||||
|
" EOne : Docstring for EOne",
|
||||||
EOne : Docstring for EOne
|
" ETwo : Docstring for ETwo",
|
||||||
|
" EThree : Docstring for EThree",
|
||||||
ETwo : Docstring for ETwo
|
]:
|
||||||
|
|
||||||
EThree : Docstring for EThree""".split("\n"):
|
|
||||||
assert docstring_line in m.UnscopedEnum.__doc__
|
assert docstring_line in m.UnscopedEnum.__doc__
|
||||||
|
|
||||||
# Unscoped enums will accept ==/!= int comparisons
|
# Unscoped enums will accept ==/!= int comparisons
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ TEST_SUBMODULE(opaque_types, m) {
|
|||||||
.def(py::init<>())
|
.def(py::init<>())
|
||||||
.def("pop_back", &StringList::pop_back)
|
.def("pop_back", &StringList::pop_back)
|
||||||
/* There are multiple versions of push_back(), etc. Select the right ones. */
|
/* 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("back", (std::string & (StringList::*) ()) & StringList::back)
|
||||||
.def("__len__", [](const StringList &v) { return v.size(); })
|
.def("__len__", [](const StringList &v) { return v.size(); })
|
||||||
.def(
|
.def(
|
||||||
|
|||||||
Reference in New Issue
Block a user