chore(deps): update pre-commit hooks (#6173)
* chore(deps): update pre-commit hooks
updates:
- [github.com/pre-commit/mirrors-clang-format: v22.1.8 → v23.1.0](https://github.com/pre-commit/mirrors-clang-format/compare/v22.1.8...v23.1.0)
- [github.com/astral-sh/ruff-pre-commit: v0.16.1 → v0.16.6](https://github.com/astral-sh/ruff-pre-commit/compare/v0.16.1...v0.16.6)
- [github.com/pre-commit/mirrors-mypy: v2.3.0 → v2.3.1](https://github.com/pre-commit/mirrors-mypy/compare/v2.3.0...v2.3.1)
- [github.com/adhtruong/mirrors-typos: v1.48.0 → v1.50.1](https://github.com/adhtruong/mirrors-typos/compare/v1.48.0...v1.50.1)
- [github.com/shellcheck-py/shellcheck-py: v0.11.0.1 → v0.11.0.1-1](https://github.com/shellcheck-py/shellcheck-py/compare/v0.11.0.1...v0.11.0.1-1)
- [github.com/PyCQA/pylint: v4.0.6 → v4.0.8](https://github.com/PyCQA/pylint/compare/v4.0.6...v4.0.8)
- [github.com/python-jsonschema/check-jsonschema: 0.37.4 → 0.38.0](https://github.com/python-jsonschema/check-jsonschema/compare/0.37.4...0.38.0)
* style: pre-commit fixes
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Ralf W. Grosse-Kunstleve <rwgkio@gmail.com>
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index 1934c2d..6251152 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -25,14 +25,14 @@
# Clang format the codebase automatically
- repo: https://github.com/pre-commit/mirrors-clang-format
- rev: "v22.1.8"
+ rev: "v23.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.16.1
+ rev: v0.16.6
hooks:
- id: ruff-check
args: ["--fix", "--show-fixes"]
@@ -40,7 +40,7 @@
# Check static types with mypy
- repo: https://github.com/pre-commit/mirrors-mypy
- rev: "v2.3.0"
+ rev: "v2.3.1"
hooks:
- id: mypy
args: []
@@ -122,14 +122,14 @@
# Use mirror because pre-commit autoupdate confuses tags in the upstream repo.
# See https://github.com/crate-ci/typos/issues/390
- repo: https://github.com/adhtruong/mirrors-typos
- rev: "v1.48.0"
+ rev: "v1.50.1"
hooks:
- id: typos
args: []
# Check for common shell mistakes
- repo: https://github.com/shellcheck-py/shellcheck-py
- rev: "v0.11.0.1"
+ rev: "v0.11.0.1-1"
hooks:
- id: shellcheck
@@ -144,14 +144,14 @@
# PyLint has native support - not always usable, but works for us
- repo: https://github.com/PyCQA/pylint
- rev: "v4.0.6"
+ rev: "v4.0.8"
hooks:
- id: pylint
files: ^pybind11
# Check schemas on some of our YAML files
- repo: https://github.com/python-jsonschema/check-jsonschema
- rev: 0.37.4
+ rev: 0.38.0
hooks:
- id: check-readthedocs
- id: check-github-workflows
diff --git a/include/pybind11/detail/common.h b/include/pybind11/detail/common.h
index c8fff5c..9f8b3b3 100644
--- a/include/pybind11/detail/common.h
+++ b/include/pybind11/detail/common.h
@@ -460,8 +460,8 @@
try { \
pybind11::detail::ensure_internals(); \
static ::pybind11::detail::slots_array mod_def_slots \
- = ::pybind11::detail::init_slots(&PYBIND11_CONCAT(pybind11_exec_, name), \
- ##__VA_ARGS__); \
+ = ::pybind11::detail::init_slots( \
+ &PYBIND11_CONCAT(pybind11_exec_, name), ##__VA_ARGS__); \
static PyModuleDef def{/* m_base */ PyModuleDef_HEAD_INIT, \
/* m_name */ PYBIND11_TOSTRING(name), \
/* m_doc */ nullptr, \
diff --git a/include/pybind11/detail/internals.h b/include/pybind11/detail/internals.h
index 295485f..ffb6635 100644
--- a/include/pybind11/detail/internals.h
+++ b/include/pybind11/detail/internals.h
@@ -413,8 +413,8 @@
memory::get_guarded_delete_fn get_memory_guarded_delete = memory::get_guarded_delete;
get_trampoline_self_life_support_fn get_trampoline_self_life_support = nullptr;
- std::vector<PyObject *(*) (PyObject *, PyTypeObject *)> implicit_conversions;
- std::vector<std::pair<const std::type_info *, void *(*) (void *)>> implicit_casts;
+ std::vector<PyObject *(*)(PyObject *, PyTypeObject *)> implicit_conversions;
+ std::vector<std::pair<const std::type_info *, void *(*)(void *)>> implicit_casts;
std::vector<bool (*)(PyObject *, void *&)> *direct_conversions;
buffer_info *(*get_buffer)(PyObject *, void *) = nullptr;
void *get_buffer_data = nullptr;
diff --git a/include/pybind11/detail/struct_smart_holder.h b/include/pybind11/detail/struct_smart_holder.h
index b71981e..57cd843 100644
--- a/include/pybind11/detail/struct_smart_holder.h
+++ b/include/pybind11/detail/struct_smart_holder.h
@@ -100,7 +100,7 @@
return std::get_deleter<guarded_delete>(ptr);
}
-using get_guarded_delete_fn = guarded_delete *(*) (const std::shared_ptr<void> &);
+using get_guarded_delete_fn = guarded_delete *(*)(const std::shared_ptr<void> &);
template <typename T, typename std::enable_if<std::is_destructible<T>::value, int>::type = 0>
inline void std_default_delete_if_destructible(void *raw_ptr) {
diff --git a/include/pybind11/detail/type_caster_base.h b/include/pybind11/detail/type_caster_base.h
index 161b988..82bfa0b 100644
--- a/include/pybind11/detail/type_caster_base.h
+++ b/include/pybind11/detail/type_caster_base.h
@@ -1694,7 +1694,7 @@
}
protected:
- using Constructor = void *(*) (const void *);
+ using Constructor = void *(*)(const void *);
/* Only enabled when the types are {copy,move}-constructible *and* when the type
does not have a private operator new implementation. A comma operator is used in the
diff --git a/include/pybind11/embed.h b/include/pybind11/embed.h
index 078f419..c333892 100644
--- a/include/pybind11/embed.h
+++ b/include/pybind11/embed.h
@@ -66,7 +66,7 @@
/// Python 2.7/3.x compatible version of `PyImport_AppendInittab` and error checks.
struct embedded_module {
- using init_t = PyObject *(*) ();
+ using init_t = PyObject *(*)();
embedded_module(const char *name, init_t init) {
if (Py_IsInitialized() != 0) {
pybind11_fail("Can't add new modules after the interpreter has been initialized");
diff --git a/include/pybind11/numpy.h b/include/pybind11/numpy.h
index 5b1161d..a26ac2b 100644
--- a/include/pybind11/numpy.h
+++ b/include/pybind11/numpy.h
@@ -244,29 +244,30 @@
// `npy_common.h` defines the integer aliases. In order, it checks:
// NPY_BITSOF_LONG, NPY_BITSOF_LONGLONG, NPY_BITSOF_INT, NPY_BITSOF_SHORT, NPY_BITSOF_CHAR
// and assigns the alias to the first matching size, so we should check in this order.
- NPY_INT32_
- = platform_lookup<std::int32_t, long, int, short>(NPY_LONG_, NPY_INT_, NPY_SHORT_),
+ NPY_INT32_ = platform_lookup<std::int32_t, long, int, short>(
+ NPY_LONG_, NPY_INT_, NPY_SHORT_),
NPY_UINT32_ = platform_lookup<std::uint32_t, unsigned long, unsigned int, unsigned short>(
NPY_ULONG_, NPY_UINT_, NPY_USHORT_),
- NPY_INT64_
- = platform_lookup<std::int64_t, long, long long, int>(NPY_LONG_, NPY_LONGLONG_, NPY_INT_),
- NPY_UINT64_
- = platform_lookup<std::uint64_t, unsigned long, unsigned long long, unsigned int>(
- NPY_ULONG_, NPY_ULONGLONG_, NPY_UINT_),
+ NPY_INT64_ = platform_lookup<std::int64_t, long, long long, int>(
+ NPY_LONG_, NPY_LONGLONG_, NPY_INT_),
+ NPY_UINT64_ = platform_lookup<std::uint64_t,
+ unsigned long,
+ unsigned long long,
+ unsigned int>(NPY_ULONG_, NPY_ULONGLONG_, NPY_UINT_),
NPY_FLOAT32_ = platform_lookup<float, double, float, long double>(
NPY_DOUBLE_, NPY_FLOAT_, NPY_LONGDOUBLE_),
NPY_FLOAT64_ = platform_lookup<double, double, float, long double>(
NPY_DOUBLE_, NPY_FLOAT_, NPY_LONGDOUBLE_),
- NPY_COMPLEX64_
- = platform_lookup<std::complex<float>,
- std::complex<double>,
- std::complex<float>,
- std::complex<long double>>(NPY_DOUBLE_, NPY_FLOAT_, NPY_LONGDOUBLE_),
- NPY_COMPLEX128_
- = platform_lookup<std::complex<double>,
- std::complex<double>,
- std::complex<float>,
- std::complex<long double>>(NPY_DOUBLE_, NPY_FLOAT_, NPY_LONGDOUBLE_),
+ NPY_COMPLEX64_ = platform_lookup<std::complex<float>,
+ std::complex<double>,
+ std::complex<float>,
+ std::complex<long double>>(
+ NPY_DOUBLE_, NPY_FLOAT_, NPY_LONGDOUBLE_),
+ NPY_COMPLEX128_ = platform_lookup<std::complex<double>,
+ std::complex<double>,
+ std::complex<float>,
+ std::complex<long double>>(
+ NPY_DOUBLE_, NPY_FLOAT_, NPY_LONGDOUBLE_),
NPY_CHAR_ = std::is_signed<char>::value ? NPY_BYTE_ : NPY_UBYTE_,
};
diff --git a/include/pybind11/pybind11.h b/include/pybind11/pybind11.h
index f57514a..3687983 100644
--- a/include/pybind11/pybind11.h
+++ b/include/pybind11/pybind11.h
@@ -1932,8 +1932,7 @@
};
/// Set the pointer to operator new if it exists. The cast is needed because it can be overloaded.
-template <typename T,
- typename = void_t<decltype(static_cast<void *(*) (size_t)>(T::operator new))>>
+template <typename T, typename = void_t<decltype(static_cast<void *(*)(size_t)>(T::operator new))>>
void set_operator_new(type_record *r) {
r->operator_new = &T::operator new;
}
diff --git a/include/pybind11/trampoline_self_life_support.h b/include/pybind11/trampoline_self_life_support.h
index cbfec7f..18bba4a 100644
--- a/include/pybind11/trampoline_self_life_support.h
+++ b/include/pybind11/trampoline_self_life_support.h
@@ -59,7 +59,7 @@
};
PYBIND11_NAMESPACE_BEGIN(detail)
-using get_trampoline_self_life_support_fn = trampoline_self_life_support *(*) (void *);
+using get_trampoline_self_life_support_fn = trampoline_self_life_support *(*)(void *);
PYBIND11_NAMESPACE_END(detail)
PYBIND11_NAMESPACE_END(PYBIND11_NAMESPACE)
diff --git a/tests/pybind11_tests.cpp b/tests/pybind11_tests.cpp
index 5dacd7a..3f342a0 100644
--- a/tests/pybind11_tests.cpp
+++ b/tests/pybind11_tests.cpp
@@ -51,7 +51,7 @@
.def_readwrite("copy_constructions", &ConstructorStats::copy_constructions)
.def_readwrite("move_constructions", &ConstructorStats::move_constructions)
.def_static("get",
- (ConstructorStats & (*) (py::object)) & ConstructorStats::get,
+ (ConstructorStats & (*)(py::object)) & ConstructorStats::get,
py::return_value_policy::reference_internal)
// Not exactly ConstructorStats, but related: expose the internal pybind number of
diff --git a/tests/test_opaque_types.cpp b/tests/test_opaque_types.cpp
index 2e972d0..a23e879 100644
--- a/tests/test_opaque_types.cpp
+++ b/tests/test_opaque_types.cpp
@@ -29,7 +29,7 @@
.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("back", (std::string & (StringList::*) ()) & StringList::back)
+ .def("back", (std::string & (StringList::*)()) & StringList::back)
.def("__len__", [](const StringList &v) { return v.size(); })
.def(
"__iter__",
diff --git a/tests/test_with_catch/test_args_convert_vector.cpp b/tests/test_with_catch/test_args_convert_vector.cpp
index 7ce2d71..aa77784 100644
--- a/tests/test_with_catch/test_args_convert_vector.cpp
+++ b/tests/test_with_catch/test_args_convert_vector.cpp
@@ -46,7 +46,7 @@
// have to work with C++11, which doesn't have generic lambdas.
// NOLINTBEGIN(bugprone-macro-parentheses)
#define MUTATION_LAMBDA(capture, block) \
- [capture](args_convert_vector & vec) block, [capture](std::vector<bool> & vec) block
+ [capture](args_convert_vector &vec) block, [capture](std::vector<bool> &vec) block
// NOLINTEND(bugprone-macro-parentheses)
// For readability, rather than having ugly empty arguments.
diff --git a/tests/test_with_catch/test_argument_vector.cpp b/tests/test_with_catch/test_argument_vector.cpp
index 9cf302a..eec4648 100644
--- a/tests/test_with_catch/test_argument_vector.cpp
+++ b/tests/test_with_catch/test_argument_vector.cpp
@@ -64,7 +64,7 @@
// have to work with C++11, which doesn't have generic lambdas.
// NOLINTBEGIN(bugprone-macro-parentheses)
#define MUTATION_LAMBDA(capture, block) \
- [capture](argument_vector & vec) block, [capture](std::vector<py::handle> & vec) block
+ [capture](argument_vector &vec) block, [capture](std::vector<py::handle> &vec) block
// NOLINTEND(bugprone-macro-parentheses)
// For readability, rather than having ugly empty arguments.