[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
This commit is contained in:
committed by
Benjamin Nauck
parent
b38170cb02
commit
44e15af433
@@ -45,12 +45,18 @@ std::string FemPostPipelinePy::representation() const
|
||||
|
||||
PyObject* FemPostPipelinePy::read(PyObject* args)
|
||||
{
|
||||
PyObject *files;
|
||||
PyObject *values = nullptr;
|
||||
PyObject *unitobj = nullptr;
|
||||
PyObject* files;
|
||||
PyObject* values = nullptr;
|
||||
PyObject* unitobj = nullptr;
|
||||
const char* value_type;
|
||||
|
||||
if (PyArg_ParseTuple(args, "O|OO!s", &files, &values, &(Base::UnitPy::Type), &unitobj, &value_type)) {
|
||||
if (PyArg_ParseTuple(args,
|
||||
"O|OO!s",
|
||||
&files,
|
||||
&values,
|
||||
&(Base::UnitPy::Type),
|
||||
&unitobj,
|
||||
&value_type)) {
|
||||
if (!values) {
|
||||
|
||||
// single argument version was called!
|
||||
@@ -64,12 +70,13 @@ PyObject* FemPostPipelinePy::read(PyObject* args)
|
||||
}
|
||||
else if (values && unitobj) {
|
||||
|
||||
//multistep version!
|
||||
// multistep version!
|
||||
|
||||
if ( !(PyTuple_Check(files) || PyList_Check(files)) ||
|
||||
!(PyTuple_Check(values) || PyList_Check(values)) ) {
|
||||
if (!(PyTuple_Check(files) || PyList_Check(files))
|
||||
|| !(PyTuple_Check(values) || PyList_Check(values))) {
|
||||
|
||||
std::string error = std::string("Files and values must be list of strings and number respectively.");
|
||||
std::string error = std::string(
|
||||
"Files and values must be list of strings and number respectively.");
|
||||
throw Base::TypeError(error);
|
||||
}
|
||||
|
||||
@@ -87,7 +94,7 @@ PyObject* FemPostPipelinePy::read(PyObject* args)
|
||||
file_result[i] = Base::FileInfo(path.as_string());
|
||||
}
|
||||
|
||||
//extract the values
|
||||
// extract the values
|
||||
Py::Sequence values_list(values);
|
||||
size = values_list.size();
|
||||
std::vector<double> value_result;
|
||||
@@ -128,12 +135,18 @@ PyObject* FemPostPipelinePy::scale(PyObject* args)
|
||||
|
||||
PyObject* FemPostPipelinePy::load(PyObject* args)
|
||||
{
|
||||
PyObject *py;
|
||||
PyObject *list = nullptr;
|
||||
PyObject *unitobj = nullptr;
|
||||
PyObject* py;
|
||||
PyObject* list = nullptr;
|
||||
PyObject* unitobj = nullptr;
|
||||
const char* value_type;
|
||||
|
||||
if (PyArg_ParseTuple(args, "O|OO!s", &py, &list, &(Base::UnitPy::Type), &unitobj, &value_type)) {
|
||||
if (PyArg_ParseTuple(args,
|
||||
"O|OO!s",
|
||||
&py,
|
||||
&list,
|
||||
&(Base::UnitPy::Type),
|
||||
&unitobj,
|
||||
&value_type)) {
|
||||
|
||||
if (!list) {
|
||||
|
||||
@@ -143,7 +156,8 @@ PyObject* FemPostPipelinePy::load(PyObject* args)
|
||||
PyErr_SetString(PyExc_TypeError, "object is not a result object");
|
||||
return nullptr;
|
||||
}
|
||||
App::DocumentObject* obj = static_cast<App::DocumentObjectPy*>(py)->getDocumentObjectPtr();
|
||||
App::DocumentObject* obj =
|
||||
static_cast<App::DocumentObjectPy*>(py)->getDocumentObjectPtr();
|
||||
if (!obj->isDerivedFrom<FemResultObject>()) {
|
||||
PyErr_SetString(PyExc_TypeError, "object is not a result object");
|
||||
return nullptr;
|
||||
@@ -154,12 +168,13 @@ PyObject* FemPostPipelinePy::load(PyObject* args)
|
||||
}
|
||||
else if (list && unitobj) {
|
||||
|
||||
//multistep version!
|
||||
// multistep version!
|
||||
|
||||
if ( !(PyTuple_Check(py) || PyList_Check(py)) ||
|
||||
!(PyTuple_Check(list) || PyList_Check(list)) ) {
|
||||
if (!(PyTuple_Check(py) || PyList_Check(py))
|
||||
|| !(PyTuple_Check(list) || PyList_Check(list))) {
|
||||
|
||||
std::string error = std::string("Result and value must be list of ResultObject and number respectively.");
|
||||
std::string error = std::string(
|
||||
"Result and value must be list of ResultObject and number respectively.");
|
||||
throw Base::TypeError(error);
|
||||
}
|
||||
|
||||
@@ -172,7 +187,8 @@ PyObject* FemPostPipelinePy::load(PyObject* args)
|
||||
for (Py::Sequence::size_type i = 0; i < size; i++) {
|
||||
Py::Object item = result_list[i];
|
||||
if (!PyObject_TypeCheck(*item, &(DocumentObjectPy::Type))) {
|
||||
std::string error = std::string("type in result list must be 'ResultObject', not ");
|
||||
std::string error =
|
||||
std::string("type in result list must be 'ResultObject', not ");
|
||||
throw Base::TypeError(error);
|
||||
}
|
||||
auto obj = static_cast<DocumentObjectPy*>(*item)->getDocumentObjectPtr();
|
||||
@@ -182,7 +198,7 @@ PyObject* FemPostPipelinePy::load(PyObject* args)
|
||||
results[i] = static_cast<FemResultObject*>(obj);
|
||||
}
|
||||
|
||||
//extract the values
|
||||
// extract the values
|
||||
Py::Sequence values_list(list);
|
||||
size = values_list.size();
|
||||
std::vector<double> values;
|
||||
@@ -206,9 +222,10 @@ PyObject* FemPostPipelinePy::load(PyObject* args)
|
||||
// Finally call the c++ function!
|
||||
getFemPostPipelinePtr()->load(results, values, unit, step_type);
|
||||
Py_Return;
|
||||
|
||||
} else {
|
||||
std::string error = std::string("Multistep load requries 4 arguments: ResultList, ValueList, unit, type");
|
||||
}
|
||||
else {
|
||||
std::string error = std::string(
|
||||
"Multistep load requries 4 arguments: ResultList, ValueList, unit, type");
|
||||
throw Base::TypeError(error);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user