MCPcopy Create free account
hub / github.com/MTG/essentia / paramValue

Method paramValue

src/python/pystreamingalgorithm.cpp:300–326  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

298
299
300PyObject* PyStreamingAlgorithm::paramValue(PyStreamingAlgorithm* self, PyObject* obj) {
301 if (!PyString_Check(obj)) {
302 PyErr_SetString(PyExc_TypeError, "expected string as argument");
303 return NULL;
304 }
305
306 string name = PyString_AS_STRING(obj);
307
308 // check if parameter exists
309 if (self->algo->defaultParameters().find(name) == self->algo->defaultParameters().end()) {
310 ostringstream msg;
311 msg << "'" << name << "' is not a parameter of " << self->algo->name();
312 PyErr_SetString(PyExc_ValueError, msg.str().c_str());
313 return NULL;
314 }
315
316 // determine the type of the parameter and return the appropriate Python object
317 PyObject* result = paramToPython( self->algo->parameter(name) );
318
319 if (result == NULL) {
320 // param not configured
321 Py_RETURN_NONE;
322 }
323 else {
324 return result;
325 }
326}
327
328
329PyObject* PyStreamingAlgorithm::getDoc(PyStreamingAlgorithm* self) {

Callers

nothing calls this directly

Calls 4

paramToPythonFunction · 0.85
strMethod · 0.80
endMethod · 0.45
nameMethod · 0.45

Tested by

no test coverage detected