std::string copyList(PyObject *pyList, std::list<std::string>& cppList)
{
std::string error="";
- if(not PyList_Check(pyList))
+ if(!PyList_Check(pyList))
{
error = "Not a python list.\n";
//throw Py2yacsException("Not a python list.");
for(Py_ssize_t i=0; i<n; i++)
{
PyObject *elem = PyList_GetItem(pyList,i);
- if(not PyUnicode_Check(elem))
+ if(!PyUnicode_Check(elem))
{
std::stringstream message;
message << "List element number " << i << " is not a string.\n";
std::string& error)
{
PyObject *pAttribute = PyObject_GetAttrString(p, attribute);
- if(not pAttribute)
+ if(!pAttribute)
{
error += "Attribute '";
error += attribute;
pModule = PyImport_Import(pValue);
Py_DECREF(pValue);
- if (not pModule)
+ if (!pModule)
{
errorMessage = getPyErrorText();
errorMessage += "\nFailed to load ";
pValue = PyObject_CallObject(pFunc, pArgs);
Py_DECREF(pArgs);
- if (not pValue)
+ if (!pValue)
errorMessage = getPyErrorText();
else
{
- if (not PyTuple_Check(pValue))
+ if (!PyTuple_Check(pValue))
{
errorMessage += "Parsing function should return a tuple of two string lists.\n";
}
errorMessage += "Parsing function should return two string lists.\n";
}
PyObject *pyList = PyTuple_GetItem(pValue, 0);
- if(not PyList_Check(pyList))
+ if(!PyList_Check(pyList))
{
errorMessage += "The first returned value of the parsing function"
" should be a python list.\n";
if(pAttribute = checkAndGetAttribute(fpy, "name", errorMessage))
{
- if(not PyUnicode_Check(pAttribute))
+ if(!PyUnicode_Check(pAttribute))
{
errorMessage += "Attribute 'name' should be a string.\n";
Py_DECREF(pAttribute);
Py_DECREF(pModule);
}
- if(not errorMessage.empty())
+ if(!errorMessage.empty())
throw Py2yacsException(errorMessage);
// Py_Finalize();
}
YACS::ENGINE::Proc* Py2yacs::createProc(const std::string& python_function)const
{
- if(not _global_errors.empty())
+ if(!_global_errors.empty())
{
std::string error_message = "The python script contains errors.\n";
std::list<std::string>::const_iterator it;
// find function properties
std::list<FunctionProperties>::const_iterator fn_prop = _functions.begin();
- while(fn_prop != _functions.end() and fn_prop->_name != python_function)
+ while(fn_prop != _functions.end() && fn_prop->_name != python_function)
fn_prop++;
if(fn_prop == _functions.end())
throw Py2yacsException(std::string("Function not found: ")+python_function);
}
- if(not fn_prop->_errors.empty())
+ if(!fn_prop->_errors.empty())
{
std::string error_message = "Function contains errors.\n";
std::list<std::string>::const_iterator it;
it!=fn_prop->_output_ports.end();
it++)
{
- if (not first)
+ if (!first)
fn_call << ",";
first = false;
fn_call << *it;
it != fn_prop->_input_ports.end();
it++)
{
- if (not first)
+ if (!first)
fn_call << ",";
first = false;
fn_call << *it;
node->edAddOutputPort(*it, tc_double);
return schema;
-}
+}
\ No newline at end of file