Minor refactor of the python wrappers (#8847)

* refactor python wrappers

* fix FilterHierarchyMatcher converted already registered warning
This commit is contained in:
Ricardo Rodriguez
2025-10-05 09:42:31 +02:00
committed by GitHub
parent 66787fe604
commit a4b63d7df5
29 changed files with 381 additions and 421 deletions

View File

@@ -25,8 +25,7 @@ namespace {
void SetCoordMap(CoordGen::CoordGenParams *self, python::dict &coordMap) {
self->coordMap.clear();
python::list ks = coordMap.keys();
for (unsigned int i = 0;
i < python::extract<unsigned int>(ks.attr("__len__")()); i++) {
for (unsigned int i = 0; i < boost::python::len(ks); ++i) {
unsigned int id = python::extract<unsigned int>(ks[i]);
self->coordMap[id] = python::extract<RDGeom::Point2D>(coordMap[id]);
}

View File

@@ -71,7 +71,7 @@ double calcSASAHelper(const RDKit::ROMol &mol, python::object radii,
std::vector<double> vradii;
unsigned int sz = python::extract<unsigned int>(radii.attr("__len__")());
unsigned int sz = boost::python::len(radii);
for (unsigned int i = 0; i < sz; ++i) {
vradii.push_back(python::extract<double>(radii[i])());
}