mirror of
https://github.com/pybind/pybind11.git
synced 2024-11-22 13:15:12 +00:00
Go all the way fixing clang-tidy issues to avoid the NOLINTNEXTLINE clutter and clang-format issues. This was really meant to be part of PR #3051 but was held back either out of an abundance of caution, or because of confusion caused by stray semicolons. (#3086)
This commit is contained in:
parent
b5357d1fa8
commit
bac5a0c370
@ -10,8 +10,11 @@
|
||||
#include "pybind11_tests.h"
|
||||
#include "local_bindings.h"
|
||||
#include "test_exceptions.h"
|
||||
|
||||
#include <pybind11/stl_bind.h>
|
||||
|
||||
#include <numeric>
|
||||
#include <utility>
|
||||
|
||||
PYBIND11_MODULE(pybind11_cross_module_tests, m) {
|
||||
m.doc() = "pybind11 cross-module test module";
|
||||
@ -104,9 +107,10 @@ PYBIND11_MODULE(pybind11_cross_module_tests, m) {
|
||||
m.def("return_self", [](LocalVec *v) { return v; });
|
||||
m.def("return_copy", [](const LocalVec &v) { return LocalVec(v); });
|
||||
|
||||
// Changing this broke things with pygrep. TODO fix
|
||||
// NOLINTNEXTLINE
|
||||
class Dog : public pets::Pet { public: Dog(std::string name) : Pet(name) {}; };
|
||||
class Dog : public pets::Pet {
|
||||
public:
|
||||
Dog(std::string name) : Pet(std::move(name)) {}
|
||||
};
|
||||
py::class_<pets::Pet>(m, "Pet", py::module_local())
|
||||
.def("name", &pets::Pet::name);
|
||||
// Binding for local extending class:
|
||||
|
@ -151,10 +151,12 @@ TEST_SUBMODULE(builtin_casters, m) {
|
||||
m.def("int_passthrough_noconvert", [](int arg) { return arg; }, py::arg{}.noconvert());
|
||||
|
||||
// test_tuple
|
||||
// NOLINTNEXTLINE(performance-unnecessary-value-param)
|
||||
m.def("pair_passthrough", [](std::pair<bool, std::string> input) {
|
||||
m.def(
|
||||
"pair_passthrough",
|
||||
[](const std::pair<bool, std::string> &input) {
|
||||
return std::make_pair(input.second, input.first);
|
||||
}, "Return a pair in reversed order");
|
||||
},
|
||||
"Return a pair in reversed order");
|
||||
m.def("tuple_passthrough", [](std::tuple<bool, std::string, int> input) {
|
||||
return std::make_tuple(std::get<2>(input), std::get<1>(input), std::get<0>(input));
|
||||
}, "Return a triple in reversed order");
|
||||
|
@ -106,10 +106,15 @@ TEST_SUBMODULE(kwargs_and_defaults, m) {
|
||||
py::arg() = 3, "j"_a = 4, py::kw_only(), "k"_a = 5, "z"_a);
|
||||
m.def("kw_only_mixed", [](int i, int j) { return py::make_tuple(i, j); },
|
||||
"i"_a, py::kw_only(), "j"_a);
|
||||
// NOLINTNEXTLINE(performance-unnecessary-value-param)
|
||||
m.def("kw_only_plus_more", [](int i, int j, int k, py::kwargs kwargs) {
|
||||
return py::make_tuple(i, j, k, kwargs); },
|
||||
py::arg() /* positional */, py::arg("j") = -1 /* both */, py::kw_only(), py::arg("k") /* kw-only */);
|
||||
m.def(
|
||||
"kw_only_plus_more",
|
||||
[](int i, int j, int k, const py::kwargs &kwargs) {
|
||||
return py::make_tuple(i, j, k, kwargs);
|
||||
},
|
||||
py::arg() /* positional */,
|
||||
py::arg("j") = -1 /* both */,
|
||||
py::kw_only(),
|
||||
py::arg("k") /* kw-only */);
|
||||
|
||||
m.def("register_invalid_kw_only", [](py::module_ m) {
|
||||
m.def("bad_kw_only", [](int i, int j) { return py::make_tuple(i, j); },
|
||||
|
@ -10,9 +10,12 @@
|
||||
|
||||
#include "pybind11_tests.h"
|
||||
#include "local_bindings.h"
|
||||
|
||||
#include <pybind11/stl.h>
|
||||
#include <pybind11/stl_bind.h>
|
||||
|
||||
#include <numeric>
|
||||
#include <utility>
|
||||
|
||||
TEST_SUBMODULE(local_bindings, m) {
|
||||
// test_load_external
|
||||
@ -86,9 +89,10 @@ TEST_SUBMODULE(local_bindings, m) {
|
||||
m.def("return_self", [](LocalVec *v) { return v; });
|
||||
m.def("return_copy", [](const LocalVec &v) { return LocalVec(v); });
|
||||
|
||||
// Reformatting this class broke pygrep checks
|
||||
// NOLINTNEXTLINE
|
||||
class Cat : public pets::Pet { public: Cat(std::string name) : Pet(name) {}; };
|
||||
class Cat : public pets::Pet {
|
||||
public:
|
||||
Cat(std::string name) : Pet(std::move(name)) {}
|
||||
};
|
||||
py::class_<pets::Pet>(m, "Pet", py::module_local())
|
||||
.def("get_name", &pets::Pet::name);
|
||||
// Binding for local extending class:
|
||||
|
Loading…
Reference in New Issue
Block a user