Lines Matching defs:arg

108 // py::arg/py::arg_v testing: these arguments just record their argument when invoked
109 class ArgInspector1 { public: std::string arg = "(default arg inspector 1)"; };
110 class ArgInspector2 { public: std::string arg = "(default arg inspector 2)"; };
118 value.arg = "loading ArgInspector1 argument " +
125 return str(src.arg).release();
133 value.arg = "loading ArgInspector2 argument " +
140 return str(src.arg).release();
178 // Test None-allowed py::arg argument policy
368 return a.arg + "\n" + b.arg + "\n" + std::to_string(c) + "\n" + d->arg;
374 .def("f", &ArgInspector::f, py::arg(), py::arg() = ArgAlwaysConverts())
375 .def("g", &ArgInspector::g, "a"_a.noconvert(), "b"_a, "c"_a.noconvert()=13, "d"_a=ArgInspector2(), py::arg() = ArgAlwaysConverts())
376 .def_static("h", &ArgInspector::h, py::arg().noconvert(), py::arg() = ArgAlwaysConverts())
378 m.def("arg_inspect_func", [](ArgInspector2 a, ArgInspector1 b, ArgAlwaysConverts) { return a.arg + "\n" + b.arg; },
379 py::arg().noconvert(false), py::arg_v(nullptr, ArgInspector1()).noconvert(true), py::arg() = ArgAlwaysConverts());
381 m.def("floats_preferred", [](double f) { return 0.5 * f; }, py::arg("f"));
382 m.def("floats_only", [](double f) { return 0.5 * f; }, py::arg("f").noconvert());
383 m.def("ints_preferred", [](int i) { return i / 2; }, py::arg("i"));
384 m.def("ints_only", [](int i) { return i / 2; }, py::arg("i").noconvert());
387 // Issue/PR #648: bad arg default debugging output
395 m.def("should_fail", [](int, UnregisteredType) {}, py::arg(), py::arg("a") = UnregisteredType());
399 m.def("should_fail", [](int, UnregisteredType) {}, py::arg(), py::arg() = UnregisteredType());
405 m.def("no_none1", &none1, py::arg().none(false));
406 m.def("no_none2", &none2, py::arg().none(false));
407 m.def("no_none3", &none3, py::arg().none(false));
408 m.def("no_none4", &none4, py::arg().none(false));
409 m.def("no_none5", &none5, py::arg().none(false));
411 m.def("ok_none2", &none2, py::arg().none(true));
413 m.def("ok_none4", &none4, py::arg().none(true));