MCPcopy Create free account
hub / github.com/HViktorTsoi/FAST_LIO_LOCALIZATION / safe_import

Method safe_import

include/matplotlibcpp.h:114–124  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

112 }
113
114 PyObject* safe_import(PyObject* module, std::string fname) {
115 PyObject* fn = PyObject_GetAttrString(module, fname.c_str());
116
117 if (!fn)
118 throw std::runtime_error(std::string("Couldn't find required function: ") + fname);
119
120 if (!PyFunction_Check(fn))
121 throw std::runtime_error(fname + std::string(" is unexpectedly not a PyFunction."));
122
123 return fn;
124 }
125
126private:
127

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected