remove kwd argument for functions only with flag METH_VARARGS

This commit is contained in:
wmayer
2018-08-08 17:39:32 +02:00
parent e13c09235f
commit ddfa3c8843
12 changed files with 285 additions and 290 deletions

View File

@@ -43,7 +43,7 @@ using namespace Base;
// UnitsApi Methods // Methods structure
PyMethodDef UnitsApi::Methods[] = {
//{"translateUnit", (PyCFunction) UnitsApi::sTranslateUnit ,1,
//{"translateUnit", (PyCFunction) UnitsApi::sTranslateUnit, METH_VARARGS,
// "translateUnit(string) -> double\n\n"
// "calculate a mathematical expression with units to a number. \n"
// "can be used for simple unit translation like: \n"
@@ -51,7 +51,7 @@ PyMethodDef UnitsApi::Methods[] = {
// " or for more complex espressions:\n"
// " translateUnit('sin(pi)/50.0 m/s^2')\n"
//},
//{"getWithPrefs", (PyCFunction) UnitsApi::sGetWithPrefs ,1,
//{"getWithPrefs", (PyCFunction) UnitsApi::sGetWithPrefs, METH_VARARGS,
// "getWithPrefs(type,[string|float|int]) -> double\n\n"
// "Translation to internal regarding user prefs \n"
// " That means if no unit is issued the user prefs are in \n"
@@ -68,7 +68,7 @@ PyMethodDef UnitsApi::Methods[] = {
// " Temperature \n"
//},
{"parseQuantity", (PyCFunction) UnitsApi::sParseQuantity ,1,
{"parseQuantity", (PyCFunction) UnitsApi::sParseQuantity, METH_VARARGS,
"parseQuantity(string) -> Base.Quantity()\n\n"
"calculate a mathematical expression with units to a quantity object. \n"
"can be used for simple unit translation like: \n"
@@ -76,15 +76,15 @@ PyMethodDef UnitsApi::Methods[] = {
"or for more complex espressions:\n"
"parseQuantity('sin(pi)/50.0 m/s^2')\n"
},
{"listSchemas", (PyCFunction) UnitsApi::sListSchemas ,1,
{"listSchemas", (PyCFunction) UnitsApi::sListSchemas, METH_VARARGS,
"listSchemas() -> a tuple of schemas\n\n"
"listSchemas(int) -> description of the given schema\n\n"
},
{"getSchema", (PyCFunction) UnitsApi::sGetSchema ,1,
{"getSchema", (PyCFunction) UnitsApi::sGetSchema, METH_VARARGS,
"getSchema() -> int\n\n"
"The int is the position of the tuple returned by listSchemas"
},
{"schemaTranslate", (PyCFunction) UnitsApi::sSchemaTranslate ,1,
{"schemaTranslate", (PyCFunction) UnitsApi::sSchemaTranslate, METH_VARARGS,
"schemaTranslate(Quantity, int) -> tuple\n\n"
"Translate a quantity to a given schema"
},
@@ -92,7 +92,7 @@ PyMethodDef UnitsApi::Methods[] = {
{NULL, NULL, 0, NULL} /* Sentinel */
};
//PyObject* UnitsApi::sTranslateUnit(PyObject * /*self*/, PyObject *args,PyObject * /*kwd*/)
//PyObject* UnitsApi::sTranslateUnit(PyObject * /*self*/, PyObject *args)
//{
// char *pstr;
// if (!PyArg_ParseTuple(args, "s", &pstr)) // convert args: Python->C
@@ -110,7 +110,7 @@ PyMethodDef UnitsApi::Methods[] = {
// }
//}
//
//PyObject* UnitsApi::sGetWithPrefs(PyObject * /*self*/, PyObject *args,PyObject * /*kwd*/)
//PyObject* UnitsApi::sGetWithPrefs(PyObject * /*self*/, PyObject *args)
//{
// char *type;
// PyObject *obj;
@@ -138,7 +138,7 @@ PyMethodDef UnitsApi::Methods[] = {
// }
//}
PyObject* UnitsApi::sParseQuantity(PyObject * /*self*/, PyObject *args,PyObject * /*kwd*/)
PyObject* UnitsApi::sParseQuantity(PyObject * /*self*/, PyObject *args)
{
char *pstr;
if (!PyArg_ParseTuple(args, "et", "utf-8", &pstr)) // convert args: Python->C
@@ -162,7 +162,7 @@ PyObject* UnitsApi::sParseQuantity(PyObject * /*self*/, PyObject *args,PyObject
return new QuantityPy(new Quantity(rtn));
}
PyObject* UnitsApi::sListSchemas(PyObject * /*self*/, PyObject *args,PyObject * /*kwd*/)
PyObject* UnitsApi::sListSchemas(PyObject * /*self*/, PyObject *args)
{
if (PyArg_ParseTuple(args, "")) {
int num = NumUnitSystemTypes;
@@ -190,7 +190,7 @@ PyObject* UnitsApi::sListSchemas(PyObject * /*self*/, PyObject *args,PyObject *
return 0;
}
PyObject* UnitsApi::sGetSchema(PyObject * /*self*/, PyObject *args,PyObject * /*kwd*/)
PyObject* UnitsApi::sGetSchema(PyObject * /*self*/, PyObject *args)
{
if (!PyArg_ParseTuple(args, ""))
return NULL;
@@ -198,7 +198,7 @@ PyObject* UnitsApi::sGetSchema(PyObject * /*self*/, PyObject *args,PyObject * /*
return Py_BuildValue("i", static_cast<int>(actSystem));
}
PyObject* UnitsApi::sSchemaTranslate(PyObject * /*self*/, PyObject *args,PyObject * /*kwd*/)
PyObject* UnitsApi::sSchemaTranslate(PyObject * /*self*/, PyObject *args)
{
PyObject* q;
int index;