| 387 | |
| 388 | |
| 389 | PyObject* 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 | |
| 413 | PyObject* PyAlgorithm::paramType(PyAlgorithm* self, PyObject* obj) { |
no test coverage detected