Closed bertiqwerty closed 6 months ago
After a little more investigation I found the reason why you can pass both to be not None
. Includes and excludes are expanded in case they are unions like AnyFeature
. In this case it can happen that the same class (not sub-class) is included and excluded and the overlap complain appears.
But it still makes sense to exclude subclasses of inputs. I find it neither simple nor elegant but still rather confusing. Further, I think probably many use cases can represent their filter differently. E.g., if you just want CategoricalInputs
but not CategoricalDescriptorInputs
you can use exact
. If you want CategoricalInputs
and CategoricalDescriptorInputs
but not MolecularDescriptorInput
you can use include and exact again. On the other hand, if you want all NumericalInput
s and CategoricalInput
s except CategoricalDescriptorInputs
it might be tedious with exact
. But who wants that? Or if you want that you can still use the filter_by_class
-function directly.
Not sure how to proceed.
!=None
. Not sure if any BoFire users rely on this. (includes=ContinuousInput, excludes=ContinuousInput)
which looks like a user error. Maybe we should check for overlap before we expand the Union
s? What do you think @jduerholt ?
In commit c5aa866 I kept the both-can-be-something behavior but moved the overlap check. Now you can pass AnyFeature
and still exclude stuff which should not break the API. As mentioned above I would prefer the only-one-can-be-something behavior if this is acceptable but we can also leave it like this.
I added some
Optional
s that where missing. I also am confused about includes and excludes and added some tests.Now I understand how includes/excludes work but I am still confused why it is an option to pass both, includes and excludes. It complains about overlaps anyways. Further, if I pass just excludes it fails with overlap. I think the default of includes should be
None
and in case both areNone
we should just skip thefilter_by_class
part and return the whole thing. But probably I have missed something.