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 greg landrum
parent 5d162eaf1f
commit c63ddaffa2
29 changed files with 381 additions and 421 deletions

View File

@@ -71,7 +71,7 @@ python::list pyToList(SparseIntVect<IndexType> &vect) {
template <typename T>
python::list BulkDice(const T &siv1, python::list sivs, bool returnDistance) {
python::list res;
unsigned int nsivs = python::extract<unsigned int>(sivs.attr("__len__")());
unsigned int nsivs = python::len(sivs);
for (unsigned int i = 0; i < nsivs; ++i) {
double simVal;
const T *siv2 = python::extract<T *>(sivs[i])();
@@ -84,7 +84,7 @@ template <typename T>
python::list BulkTanimoto(const T &siv1, python::list sivs,
bool returnDistance) {
python::list res;
unsigned int nsivs = python::extract<unsigned int>(sivs.attr("__len__")());
unsigned int nsivs = python::len(sivs);
for (unsigned int i = 0; i < nsivs; ++i) {
double simVal;
const T *siv2 = python::extract<T *>(sivs[i])();
@@ -98,7 +98,7 @@ template <typename T>
python::list BulkTversky(const T &siv1, python::list sivs, double a, double b,
bool returnDistance) {
python::list res;
unsigned int nsivs = python::extract<unsigned int>(sivs.attr("__len__")());
unsigned int nsivs = python::len(sivs);
for (unsigned int i = 0; i < nsivs; ++i) {
double simVal;
const T *siv2 = python::extract<T *>(sivs[i])();