diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 05626151c1..5ee5846b5f 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -25,14 +25,14 @@ repos: # 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 @@ repos: # 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 @@ repos: # 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 1c4973b748..6d0e851fa9 100644 --- a/include/pybind11/cast.h +++ b/include/pybind11/cast.h @@ -199,8 +199,7 @@ public: template >::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 @@ PYBIND11_NAMESPACE_END(detail) template ::value && !detail::is_same_ignoring_cvref::value, - int> - = 0> + int> = 0> T cast(const handle &handle) { using namespace detail; constexpr bool is_enum_cast = type_uses_type_caster_enum_type>::value; @@ -1699,8 +1697,7 @@ template ::value && detail::is_same_ignoring_cvref::value, - int> - = 0> + int> = 0> T cast(Handle &&handle) { return handle.inc_ref().ptr(); } @@ -1709,8 +1706,7 @@ template ::value && detail::is_same_ignoring_cvref::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 d9bcc4bc40..668e458e99 100644 --- a/include/pybind11/chrono.h +++ b/include/pybind11/chrono.h @@ -64,8 +64,7 @@ class duration_caster { return src; } static const std::chrono::duration & - get_duration(const std::chrono::duration &&) - = delete; + get_duration(const std::chrono::duration &&) = delete; // If this is a time_point get the time_since_epoch template diff --git a/include/pybind11/detail/init.h b/include/pybind11/detail/init.h index b7f8d5a52c..56e0a56ab2 100644 --- a/include/pybind11/detail/init.h +++ b/include/pybind11/detail/init.h @@ -304,11 +304,10 @@ struct constructor { extra...); } - template < - typename Class, - typename... Extra, - enable_if_t, Args...>::value, int> - = 0> + template , Args...>::value, + int> = 0> static void execute(Class &cl, const Extra &...extra) { cl.def( "__init__", @@ -325,11 +324,10 @@ struct constructor { extra...); } - template < - typename Class, - typename... Extra, - enable_if_t, Args...>::value, int> - = 0> + template , Args...>::value, + int> = 0> static void execute(Class &cl, const Extra &...extra) { cl.def( "__init__", @@ -345,11 +343,10 @@ struct constructor { // Implementing class for py::init_alias<...>() template struct alias_constructor { - template < - typename Class, - typename... Extra, - enable_if_t, Args...>::value, int> - = 0> + template , 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 d719597f0d..7edd00471a 100644 --- a/include/pybind11/detail/internals.h +++ b/include/pybind11/detail/internals.h @@ -59,15 +59,13 @@ using ExceptionTranslator = void (*)(std::exception_ptr); # 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 30eae090f5..ff4be6a500 100644 --- a/include/pybind11/pytypes.h +++ b/include/pybind11/pytypes.h @@ -259,8 +259,7 @@ class handle : public detail::object_api { detail::enable_if_t, detail::is_pyobj_ptr_or_nullptr_t>, std::is_convertible>::value, - int> - = 0> + int> = 0> // NOLINTNEXTLINE(google-explicit-constructor) handle(T &obj) : m_ptr(obj) {} @@ -1694,8 +1693,7 @@ class str : public object { template >::value && std::is_constructible::value, - int> - = 0> + int> = 0> explicit str(T &&h) : object(raw_str(handle(std::forward(h)).ptr()), stolen_t{}) { if (!m_ptr) { throw error_already_set(); diff --git a/tests/test_pytypes.cpp b/tests/test_pytypes.cpp index e214350015..ff77940965 100644 --- a/tests/test_pytypes.cpp +++ b/tests/test_pytypes.cpp @@ -1086,8 +1086,7 @@ TEST_SUBMODULE(pytypes, m) { static_class.def(py::init()); static_class.attr_with_type_hint>("x") = 1.0; static_class.attr_with_type_hint>>( - "dict_str_int") - = py::dict(); + "dict_str_int") = py::dict(); struct Instance {}; auto instance = py::class_(m, "Instance", py::dynamic_attr()); diff --git a/tests/test_virtual_functions.cpp b/tests/test_virtual_functions.cpp index a6164eb81d..78a4fdfa50 100644 --- a/tests/test_virtual_functions.cpp +++ b/tests/test_virtual_functions.cpp @@ -173,8 +173,7 @@ struct AdderBase { using DataVisitor = std::function; 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;