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

Method paramValue

src/python/pyalgorithm.cpp:434–460  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

432}
433
434PyObject* PyAlgorithm::paramValue(PyAlgorithm* self, PyObject* obj) {
435 if (!PyString_Check(obj)) {
436 PyErr_SetString(PyExc_TypeError, "expected string as argument");
437 return NULL;
438 }
439
440 string name = PyString_AS_STRING(obj);
441
442 // check if parameter exists
443 if (self->algo->defaultParameters().find(name) == self->algo->defaultParameters().end()) {
444 ostringstream msg;
445 msg << "'" << name << "' is not a parameter of " << self->algo->name();
446 PyErr_SetString(PyExc_ValueError, msg.str().c_str());
447 return NULL;
448 }
449
450 // determine the type of the parameter and return the appropriate Python object
451 PyObject* result = paramToPython( self->algo->parameter(name) );
452
453 if (result == NULL) {
454 // param not configured
455 Py_RETURN_NONE;
456 }
457 else {
458 return result;
459 }
460}
461
462
463PyObject* PyAlgorithm::getDoc(PyAlgorithm* self) {

Callers 2

generate_dot_algo_labelFunction · 0.45
computeFunction · 0.45

Calls 4

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

Tested by

no test coverage detected