From 9d107d2f751d76b2c26e90cd08d2ac163022c873 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Sat, 5 Oct 2024 13:45:38 +0000 Subject: [PATCH] style: pre-commit fixes --- include/pybind11/cast.h | 6 ++++-- tests/test_kwargs_and_defaults.cpp | 7 ++++--- tests/test_kwargs_and_defaults.py | 10 ++++++++-- 3 files changed, 16 insertions(+), 7 deletions(-) diff --git a/include/pybind11/cast.h b/include/pybind11/cast.h index ebbe6c364..c2f14ebc6 100644 --- a/include/pybind11/cast.h +++ b/include/pybind11/cast.h @@ -1570,9 +1570,11 @@ class argument_loader { using indices = make_index_sequence; template - using argument_is_args = all_of>, negation>>; + using argument_is_args + = all_of>, negation>>; template - using argument_is_kwargs = all_of>, negation>>; + using argument_is_kwargs + = all_of>, negation>>; // Get kwargs argument position, or -1 if not present: static constexpr auto kwargs_pos = constexpr_last(); diff --git a/tests/test_kwargs_and_defaults.cpp b/tests/test_kwargs_and_defaults.cpp index a1a57ded6..cbaebf0d3 100644 --- a/tests/test_kwargs_and_defaults.cpp +++ b/tests/test_kwargs_and_defaults.cpp @@ -60,7 +60,7 @@ struct handle_type_name { }; template <> struct type_caster { - PYBIND11_TYPE_CASTER(MoveOrCopyInt*, const_name("MoveOrCopyInt")); + PYBIND11_TYPE_CASTER(MoveOrCopyInt *, const_name("MoveOrCopyInt")); bool load(handle src, bool) { auto as_class = MoveOrCopyInt(src.cast()); value = &as_class; @@ -389,9 +389,10 @@ TEST_SUBMODULE(kwargs_and_defaults, m) { return py::make_tuple(args, kwargs); }); - // Test that support for args and kwargs subclasses skips checking arguments passed in as pointers + // Test that support for args and kwargs subclasses skips checking arguments passed in as + // pointers m.def("args_kwargs_subclass_function_with_pointer_arg", - [](MoveOrCopyInt* pointer, const ArgsSubclass &args, const KWArgsSubclass &kwargs) { + [](MoveOrCopyInt *pointer, const ArgsSubclass &args, const KWArgsSubclass &kwargs) { return py::make_tuple(pointer->value, args, kwargs); }); } diff --git a/tests/test_kwargs_and_defaults.py b/tests/test_kwargs_and_defaults.py index 8bc086c2c..78bbb2a6b 100644 --- a/tests/test_kwargs_and_defaults.py +++ b/tests/test_kwargs_and_defaults.py @@ -107,7 +107,11 @@ def test_arg_and_kwargs(): kwargs = {"arg3": "a3", "arg4": 4} assert m.args_kwargs_function(*args, **kwargs) == (args, kwargs) assert m.args_kwargs_subclass_function(*args, **kwargs) == (args, kwargs) - assert m.args_kwargs_subclass_function_with_pointer_arg(10, *args, **kwargs) == (10, args, kwargs) + assert m.args_kwargs_subclass_function_with_pointer_arg(10, *args, **kwargs) == ( + 10, + args, + kwargs, + ) def test_mixed_args_and_kwargs(msg): @@ -429,7 +433,9 @@ def test_args_refcount(): ) assert refcount(myval) == expected - assert m.args_kwargs_subclass_function_with_pointer_arg(7, 8, myval, a=1, b=myval) == ( + assert m.args_kwargs_subclass_function_with_pointer_arg( + 7, 8, myval, a=1, b=myval + ) == ( 7, (8, myval), {"a": 1, "b": myval},