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

Method inputType

src/python/pyalgorithm.cpp:389–410  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

387
388
389PyObject* PyAlgorithm::inputType(PyAlgorithm* self, PyObject* obj) {
390 if (!PyString_Check(obj)) {
391 PyErr_SetString(PyExc_TypeError, "Algorithm.inputType expects a string as the only argument");
392 return NULL;
393 }
394
395 string name = PyString_AsString(obj);
396
397 try {
398 self->algo->input(name);
399 }
400 catch (const EssentiaException&) {
401 ostringstream msg;
402 msg << "'" << name << "' is not an input of " << self->algo->name() << ". Available inputs are " << self->algo->inputNames();
403 PyErr_SetString(PyExc_ValueError, msg.str().c_str());
404 return NULL;
405 }
406
407 string tp = edtToString( typeInfoToEdt( self->algo->input(name).typeInfo() ) );
408
409 return String::toPythonCopy(&tp);
410}
411
412
413PyObject* PyAlgorithm::paramType(PyAlgorithm* self, PyObject* obj) {

Callers 1

computeMethod · 0.80

Calls 5

edtToStringFunction · 0.85
typeInfoToEdtFunction · 0.85
strMethod · 0.80
nameMethod · 0.45
inputNamesMethod · 0.45

Tested by

no test coverage detected