MCPcopy Create free account
hub / github.com/boostorg/histogram / histogram_init

Function histogram_init

src/python/histogram.cpp:146–169  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

144}
145
146bp::object histogram_init(bp::tuple args, bp::dict kwargs) {
147
148 bp::object self = args[0];
149
150 if (kwargs) { throw std::invalid_argument("no keyword arguments allowed"); }
151
152 const unsigned dim = bp::len(args) - 1;
153
154 // normal constructor
155 pyhistogram::axes_type axes;
156 for (unsigned i = 0; i < dim; ++i) {
157 bp::object pa = args[i + 1];
158 bool success = false;
159 boost::mp11::mp_for_each<bh::axis::any_std>(axes_appender(pa, axes, success));
160 if (!success) {
161 std::string msg = "require an axis object, got ";
162 msg += bp::extract<std::string>(bp::str(pa));
163 PyErr_SetString(PyExc_TypeError, msg.c_str());
164 bp::throw_error_already_set();
165 }
166 }
167 pyhistogram h(axes, typename pyhistogram::storage_type());
168 return self.attr("__init__")(std::move(h));
169}
170
171template <typename T>
172struct fetcher {

Callers

nothing calls this directly

Calls 1

axes_appenderClass · 0.85

Tested by

no test coverage detected