-
Notifications
You must be signed in to change notification settings - Fork 867
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove redundant total_ordering
decorator usage
#4203
base: master
Are you sure you want to change the base?
Remove redundant total_ordering
decorator usage
#4203
Conversation
needed_attrs = ("lattice", "sites", "properties") | ||
|
||
# Return NotImplemented as in https://docs.python.org/3/library/functools.html#functools.total_ordering |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess total_ordering
was applied on IStructure
at some point but I believe this comment should be removed now (currently it more servers as an equality definition):
pymatgen/src/pymatgen/core/structure.py
Lines 1006 to 1007 in 31f1e1f
class IStructure(SiteCollection, MSONable): |
Also current implementation of IStructure
doesn't fulfill the prerequisite of applying total_ordering
(only __eq__
is defined):
The class must define one of lt(), le(), gt(), or ge(). In addition, the class should supply an eq() method.
5ba2460
to
06abd50
Compare
3e57593
to
689c093
Compare
689c093
to
6269071
Compare
Summary
total_ordering
decorator usage, astotal_ordering
is already applied on superclasses and child classes did not redefine any rich comparison operations.core.IStructure
from io import StringIO
when it's used only twice asio
is already imported)