Closed klimaj closed 5 months ago
Thanks @lyskov, that's a good point -- I've now moved the unit test to src/test/T121_core.ResidueSelector.py
and it's passing on the benchmark server!
This is excellent, thanks @klimaj ! (Sorry for seeing this so late.) Too bad we can't overload the logical and, or etc, but there are good reasons why not https://peps.python.org/pep-0335/ :)
This PR adds support for use of python bitwise operators for
ResidueSelector
objects in PyRosetta. Residue selectors are now able to be combined by the following PyRosetta-to-python operator symbol conversions:AndResidueSelector
-->&
OrResidueSelector
-->|
NotResidueSelector
-->~
OrResidueSelector
-->^
(there isn't technically an exclusiveOrResidueSelector
in PyRosetta, but it could be implemented with theLogic
residue selector in XML. This is intended to be equivalent to a XOR operation or the symmetric difference in set theory)AndResidueSelector
-->&=
OrResidueSelector
-->|=
OrResidueSelector
-->^=
Only python bitwise operators are affected, while python boolean operators
and
,or
andnot
are unaffected when implemented withResidueSelector
objects.Also thanks to @everyday847 for the original idea to override the
__and__
method of residue selector objects.