chore(deps): update pre-commit hooks (#6002)
* chore(deps): update pre-commit hooks
updates:
- [github.com/pre-commit/mirrors-clang-format: v21.1.8 → v22.1.0](https://github.com/pre-commit/mirrors-clang-format/compare/v21.1.8...v22.1.0)
- [github.com/astral-sh/ruff-pre-commit: v0.14.14 → v0.15.4](https://github.com/astral-sh/ruff-pre-commit/compare/v0.14.14...v0.15.4)
- [github.com/adhtruong/mirrors-typos: v1.42.3 → v1.44.0](https://github.com/adhtruong/mirrors-typos/compare/v1.42.3...v1.44.0)
- [github.com/PyCQA/pylint: v4.0.4 → v4.0.5](https://github.com/PyCQA/pylint/compare/v4.0.4...v4.0.5)
- [github.com/python-jsonschema/check-jsonschema: 0.36.1 → 0.37.0](https://github.com/python-jsonschema/check-jsonschema/compare/0.36.1...0.37.0)
* style: pre-commit fixes
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index 0562615..5ee5846 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: "v21.1.8"
+ rev: "v22.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.14.14
+ rev: v0.15.4
hooks:
- id: ruff-check
args: ["--fix", "--show-fixes"]
@@ -122,7 +122,7 @@
# 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.42.3"
+ rev: "v1.44.0"
hooks:
- id: typos
args: []
@@ -144,14 +144,14 @@
# PyLint has native support - not always usable, but works for us
- repo: https://github.com/PyCQA/pylint
- rev: "v4.0.4"
+ rev: "v4.0.5"
hooks:
- id: pylint
files: ^pybind11
# Check schemas on some of our YAML files
- repo: https://github.com/python-jsonschema/check-jsonschema
- rev: 0.36.1
+ rev: 0.37.0
hooks:
- id: check-readthedocs
- id: check-github-workflows
diff --git a/include/pybind11/cast.h b/include/pybind11/cast.h
index 1c4973b..6d0e851 100644
--- a/include/pybind11/cast.h
+++ b/include/pybind11/cast.h
@@ -199,8 +199,7 @@
template <typename T_, \
::pybind11::detail::enable_if_t< \
std::is_same<type, ::pybind11::detail::remove_cv_t<T_>>::value, \
- int> \
- = 0> \
+ int> = 0> \
static ::pybind11::handle cast( \
T_ *src, ::pybind11::return_value_policy policy, ::pybind11::handle parent) { \
if (!src) \
@@ -1663,8 +1662,7 @@
template <typename T,
detail::enable_if_t<!detail::is_pyobject<T>::value
&& !detail::is_same_ignoring_cvref<T, PyObject *>::value,
- int>
- = 0>
+ int> = 0>
T cast(const handle &handle) {
using namespace detail;
constexpr bool is_enum_cast = type_uses_type_caster_enum_type<intrinsic_t<T>>::value;
@@ -1699,8 +1697,7 @@
typename Handle,
detail::enable_if_t<detail::is_same_ignoring_cvref<T, PyObject *>::value
&& detail::is_same_ignoring_cvref<Handle, handle>::value,
- int>
- = 0>
+ int> = 0>
T cast(Handle &&handle) {
return handle.inc_ref().ptr();
}
@@ -1709,8 +1706,7 @@
typename Object,
detail::enable_if_t<detail::is_same_ignoring_cvref<T, PyObject *>::value
&& detail::is_same_ignoring_cvref<Object, object>::value,
- int>
- = 0>
+ int> = 0>
T cast(Object &&obj) {
return obj.release().ptr();
}
diff --git a/include/pybind11/chrono.h b/include/pybind11/chrono.h
index d9bcc4b..668e458 100644
--- a/include/pybind11/chrono.h
+++ b/include/pybind11/chrono.h
@@ -64,8 +64,7 @@
return src;
}
static const std::chrono::duration<rep, period> &
- get_duration(const std::chrono::duration<rep, period> &&)
- = delete;
+ get_duration(const std::chrono::duration<rep, period> &&) = delete;
// If this is a time_point get the time_since_epoch
template <typename Clock>
diff --git a/include/pybind11/detail/init.h b/include/pybind11/detail/init.h
index b7f8d5a..56e0a56 100644
--- a/include/pybind11/detail/init.h
+++ b/include/pybind11/detail/init.h
@@ -304,11 +304,10 @@
extra...);
}
- template <
- typename Class,
- typename... Extra,
- enable_if_t<Class::has_alias && std::is_constructible<Cpp<Class>, Args...>::value, int>
- = 0>
+ template <typename Class,
+ typename... Extra,
+ enable_if_t<Class::has_alias && std::is_constructible<Cpp<Class>, Args...>::value,
+ int> = 0>
static void execute(Class &cl, const Extra &...extra) {
cl.def(
"__init__",
@@ -325,11 +324,10 @@
extra...);
}
- template <
- typename Class,
- typename... Extra,
- enable_if_t<Class::has_alias && !std::is_constructible<Cpp<Class>, Args...>::value, int>
- = 0>
+ template <typename Class,
+ typename... Extra,
+ enable_if_t<Class::has_alias && !std::is_constructible<Cpp<Class>, Args...>::value,
+ int> = 0>
static void execute(Class &cl, const Extra &...extra) {
cl.def(
"__init__",
@@ -345,11 +343,10 @@
// Implementing class for py::init_alias<...>()
template <typename... Args>
struct alias_constructor {
- template <
- typename Class,
- typename... Extra,
- enable_if_t<Class::has_alias && std::is_constructible<Alias<Class>, Args...>::value, int>
- = 0>
+ template <typename Class,
+ typename... Extra,
+ enable_if_t<Class::has_alias && std::is_constructible<Alias<Class>, Args...>::value,
+ int> = 0>
static void execute(Class &cl, const Extra &...extra) {
cl.def(
"__init__",
diff --git a/include/pybind11/detail/internals.h b/include/pybind11/detail/internals.h
index d719597..7edd004 100644
--- a/include/pybind11/detail/internals.h
+++ b/include/pybind11/detail/internals.h
@@ -59,15 +59,13 @@
# define PYBIND11_TLS_KEY_INIT(var) \
_Pragma("clang diagnostic push") /**/ \
_Pragma("clang diagnostic ignored \"-Wmissing-field-initializers\"") /**/ \
- Py_tss_t var \
- = Py_tss_NEEDS_INIT; \
+ Py_tss_t var = Py_tss_NEEDS_INIT; \
_Pragma("clang diagnostic pop")
#elif defined(__GNUC__) && !defined(__INTEL_COMPILER)
# define PYBIND11_TLS_KEY_INIT(var) \
_Pragma("GCC diagnostic push") /**/ \
_Pragma("GCC diagnostic ignored \"-Wmissing-field-initializers\"") /**/ \
- Py_tss_t var \
- = Py_tss_NEEDS_INIT; \
+ Py_tss_t var = Py_tss_NEEDS_INIT; \
_Pragma("GCC diagnostic pop")
#else
# define PYBIND11_TLS_KEY_INIT(var) Py_tss_t var = Py_tss_NEEDS_INIT;
diff --git a/include/pybind11/pytypes.h b/include/pybind11/pytypes.h
index 30eae09..ff4be6a 100644
--- a/include/pybind11/pytypes.h
+++ b/include/pybind11/pytypes.h
@@ -259,8 +259,7 @@
detail::enable_if_t<detail::all_of<detail::none_of<std::is_base_of<handle, T>,
detail::is_pyobj_ptr_or_nullptr_t<T>>,
std::is_convertible<T, PyObject *>>::value,
- int>
- = 0>
+ int> = 0>
// NOLINTNEXTLINE(google-explicit-constructor)
handle(T &obj) : m_ptr(obj) {}
@@ -1694,8 +1693,7 @@
template <typename T,
detail::enable_if_t<!std::is_base_of<object, detail::remove_cvref_t<T>>::value
&& std::is_constructible<handle, T>::value,
- int>
- = 0>
+ int> = 0>
explicit str(T &&h) : object(raw_str(handle(std::forward<T>(h)).ptr()), stolen_t{}) {
if (!m_ptr) {
throw error_already_set();
diff --git a/tests/test_pytypes.cpp b/tests/test_pytypes.cpp
index e214350..ff77940 100644
--- a/tests/test_pytypes.cpp
+++ b/tests/test_pytypes.cpp
@@ -1086,8 +1086,7 @@
static_class.def(py::init());
static_class.attr_with_type_hint<py::typing::ClassVar<float>>("x") = 1.0;
static_class.attr_with_type_hint<py::typing::ClassVar<py::typing::Dict<py::str, int>>>(
- "dict_str_int")
- = py::dict();
+ "dict_str_int") = py::dict();
struct Instance {};
auto instance = py::class_<Instance>(m, "Instance", py::dynamic_attr());
diff --git a/tests/test_virtual_functions.cpp b/tests/test_virtual_functions.cpp
index a6164eb..78a4fdf 100644
--- a/tests/test_virtual_functions.cpp
+++ b/tests/test_virtual_functions.cpp
@@ -173,8 +173,7 @@
using DataVisitor = std::function<void(const Data &)>;
virtual void
- operator()(const Data &first, const Data &second, const DataVisitor &visitor) const
- = 0;
+ operator()(const Data &first, const Data &second, const DataVisitor &visitor) const = 0;
virtual ~AdderBase() = default;
AdderBase() = default;
AdderBase(const AdderBase &) = delete;