Base: Standardize on Py::Long type for Python bindings.

This commit is contained in:
tritao
2025-02-07 22:46:35 +00:00
parent 5117c82d33
commit 2145b742eb
44 changed files with 285 additions and 285 deletions

View File

@@ -666,7 +666,7 @@ Py::List AreaPy::getShapes() const
Area* area = getAreaPtr();
const std::list<Area::Shape>& shapes = area->getChildren();
for (auto& s : shapes) {
ret.append(Py::TupleN(Part::shape2pyshape(s.shape), Py::Int(s.op)));
ret.append(Py::TupleN(Part::shape2pyshape(s.shape), Py::Long(s.op)));
}
return ret;
}

View File

@@ -39,7 +39,7 @@
<Documentation>
<UserDocu>Returns the cell's category as an integer</UserDocu>
</Documentation>
<Parameter Name="SourceCategory" Type="Int"/>
<Parameter Name="SourceCategory" Type="Long"/>
</Attribute>
<Attribute Name="SourceCategoryName" ReadOnly="true">
<Documentation>

View File

@@ -134,10 +134,10 @@ Py::Long VoronoiCellPy::getSourceIndex() const
return Py::Long(index);
}
Py::Int VoronoiCellPy::getSourceCategory() const
Py::Long VoronoiCellPy::getSourceCategory() const
{
VoronoiCell* c = getVoronoiCellFromPy(this);
return Py::Int(c->ptr->source_category());
return Py::Long(c->ptr->source_category());
}
Py::String VoronoiCellPy::getSourceCategoryName() const

View File

@@ -25,13 +25,13 @@
<Documentation>
<UserDocu>The number of rows in the array.</UserDocu>
</Documentation>
<Parameter Name="Rows" Type="Int"/>
<Parameter Name="Rows" Type="Long"/>
</Attribute>
<Attribute Name="Columns" ReadOnly="true">
<Documentation>
<UserDocu>The number of columns in the array.</UserDocu>
</Documentation>
<Parameter Name="Columns" Type="Int"/>
<Parameter Name="Columns" Type="Long"/>
</Attribute>
<Methode Name="getRow" ReadOnly="true">
<Documentation>

View File

@@ -81,14 +81,14 @@ Py::List Array2DPy::getArray() const
return list;
}
Py::Int Array2DPy::getRows() const
Py::Long Array2DPy::getRows() const
{
return Py::Int(getMaterial2DArrayPtr()->rows());
return Py::Long(getMaterial2DArrayPtr()->rows());
}
Py::Int Array2DPy::getColumns() const
Py::Long Array2DPy::getColumns() const
{
return Py::Int(getMaterial2DArrayPtr()->columns());
return Py::Long(getMaterial2DArrayPtr()->columns());
}
PyObject* Array2DPy::getRow(PyObject* args)

View File

@@ -25,13 +25,13 @@
<Documentation>
<UserDocu>The number of columns in the array.</UserDocu>
</Documentation>
<Parameter Name="Columns" Type="Int"/>
<Parameter Name="Columns" Type="Long"/>
</Attribute>
<Attribute Name="Depth" ReadOnly="true">
<Documentation>
<UserDocu>The depth of the array (3rd dimension).</UserDocu>
</Documentation>
<Parameter Name="Columns" Type="Int"/>
<Parameter Name="Columns" Type="Long"/>
</Attribute>
<Methode Name="getRows" ReadOnly="true">
<Documentation>

View File

@@ -83,14 +83,14 @@ Py::List Array3DPy::getArray() const
return list;
}
Py::Int Array3DPy::getColumns() const
Py::Long Array3DPy::getColumns() const
{
return Py::Int(getMaterial3DArrayPtr()->columns());
return Py::Long(getMaterial3DArrayPtr()->columns());
}
Py::Int Array3DPy::getDepth() const
Py::Long Array3DPy::getDepth() const
{
return Py::Int(getMaterial3DArrayPtr()->depth());
return Py::Long(getMaterial3DArrayPtr()->depth());
}
PyObject* Array3DPy::getRows(PyObject* args)

View File

@@ -1054,7 +1054,7 @@ private:
if (!PyLong_Check(value)) {
throw Py::ValueError(err);
}
int order = Py::Int(value);
int order = Py::Long(value);
params.orders[s] = static_cast<TopoShape::Continuity>(order);
return;
});
@@ -1131,7 +1131,7 @@ private:
if (!PyLong_Check(value)) {
throw Py::ValueError(err);
}
int order = Py::Int(value);
int order = Py::Long(value);
params.orders[s] = static_cast<TopoShape::Continuity>(order);
return;
});

View File

@@ -65,7 +65,7 @@ PyObject *PartFeaturePy::getElementHistory(PyObject *args, PyObject *kwds) {
} else
ret.setItem(0, Py::Object(history.obj->getPyObject(), true));
} else
ret.setItem(0, Py::Int(history.tag));
ret.setItem(0, Py::Long(history.tag));
tmp.clear();
ret.setItem(1, Py::String(history.element.appendToBuffer(tmp)));
Py::List intermedates;

View File

@@ -1889,7 +1889,7 @@ PyObject* TopoShapePy::countElement(PyObject *args)
return nullptr;
PY_TRY {
return Py::new_reference_to(Py::Int((long)getTopoShapePtr()->countSubShapes(input)));
return Py::new_reference_to(Py::Long((long)getTopoShapePtr()->countSubShapes(input)));
}
PY_CATCH_OCC
}
@@ -2362,10 +2362,10 @@ PyObject* TopoShapePy::findSubShape(PyObject* args)
for (auto& s : getPyShapes(pyobj)) {
int index = getTopoShapePtr()->findShape(s.getShape());
if (index > 0) {
res.append(Py::TupleN(Py::String(s.shapeName()), Py::Int(index)));
res.append(Py::TupleN(Py::String(s.shapeName()), Py::Long(index)));
}
else {
res.append(Py::TupleN(Py::Object(), Py::Int(0)));
res.append(Py::TupleN(Py::Object(), Py::Long(0)));
}
}
if (PySequence_Check(pyobj)) {
@@ -2652,7 +2652,7 @@ PyObject* TopoShapePy::getElementHistory(PyObject* args)
Py_Return;
}
Py::Tuple ret(3);
ret.setItem(0, Py::Int(tag));
ret.setItem(0, Py::Long(tag));
std::string tmp;
ret.setItem(1, Py::String(original.appendToBuffer(tmp)));
Py::List pyHistory;

View File

@@ -114,7 +114,7 @@ private:
args.setItem(3,vector.apply(xyz));
args.setItem(4,Py::Float(radius));
args.setItem(5,Py::Int((int)0));
args.setItem(5,Py::Long((int)0));
Py::Tuple ret(method.apply(args));
Py::Object S1(ret.getItem(0));
Py::Object S2(ret.getItem(1));
@@ -154,7 +154,7 @@ private:
args.setItem(2,Py::Vector(l2));
args.setItem(3,Py::Vector(Base::Vector3d(0,0,1)));
args.setItem(4,Py::Float(radius));
//args.setItem(5,Py::Int((int)0));
//args.setItem(5,Py::Long((int)0));
args.setItem(5,Py::Long((long)1));
Py::Tuple ret(method.apply(args));
Py::Vector S1(ret.getItem(0));

View File

@@ -2462,7 +2462,7 @@ Py::List SketchObjectPy::getConflictingConstraints() const
Py::List conflicting;
for (auto cid : conflictinglist) {
conflicting.append(Py::Int(cid));
conflicting.append(Py::Long(cid));
}
return conflicting;
@@ -2475,7 +2475,7 @@ Py::List SketchObjectPy::getRedundantConstraints() const
Py::List redundant;
for (auto cid : redundantlist) {
redundant.append(Py::Int(cid));
redundant.append(Py::Long(cid));
}
return redundant;
@@ -2488,7 +2488,7 @@ Py::List SketchObjectPy::getPartiallyRedundantConstraints() const
Py::List redundant;
for (auto cid : redundantlist) {
redundant.append(Py::Int(cid));
redundant.append(Py::Long(cid));
}
return redundant;
@@ -2501,7 +2501,7 @@ Py::List SketchObjectPy::getMalformedConstraints() const
Py::List malformed;
for (auto cid : malformedlist) {
malformed.append(Py::Int(cid));
malformed.append(Py::Long(cid));
}
return malformed;

View File

@@ -178,7 +178,7 @@ PyObject* SketchPy::moveGeometry(PyObject* args)
Py::Long SketchPy::getConstraint() const
{
// return Py::Int();
// return Py::Long();
throw Py::AttributeError("Not yet implemented");
}