Make DensityAnalysis use the Results class#3263
Make DensityAnalysis use the Results class#3263orbeckst merged 13 commits intoMDAnalysis:developfrom
Conversation
|
Hello @IAlibay! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found:
Comment last updated at 2021-05-06 16:22:50 UTC |
Codecov Report
@@ Coverage Diff @@
## develop #3263 +/- ##
========================================
Coverage 93.02% 93.02%
========================================
Files 172 172
Lines 22694 22698 +4
Branches 3193 3193
========================================
+ Hits 21110 21114 +4
Misses 1534 1534
Partials 50 50
Continue to review full report at Codecov.
|
|
forgot to update the docs properly -- in progress, also the |
| self.results.density = density | ||
|
|
||
| @property | ||
| def density(self): |
There was a problem hiding this comment.
Sad the the docs become messy when we use mda's @deprecate decorator...
There was a problem hiding this comment.
Yeah it enforces docstring which is just not very human friendly :(
For the sake of a couple of extra lines I'm happy just adding the messages by hand.
There was a problem hiding this comment.
Yes, but this still looks good and as a good template for the other classes.
orbeckst
left a comment
There was a problem hiding this comment.
Looking good. Only required thing is another CHANGELOG entry under deprecations.
Thanks for creating a template for the other cases!
|
Please also resolve the conflicts. Thank you!! |
|
Going forward, is there an improvement we could make to our deprecate decorator? There is a little “deprecated” package https://python-deprecated.readthedocs.io/en/latest/api.html with a similar decorator. Maybe we check it out and adapt if it does anything better than ours (the source code is only a single file). |
From this PR, the main issue is that it didn't want to play well with not having a docstring (I don't remember this being a problem before, I think it might be a clash with |
|
Maybe defining a doc string for the attribute first would help. But ultimately, just doing it explicitly is not wrong and if it's clearer then all the better. Perhaps there's a clever helper that could do something like @deprecated_results_attribute(doc="Density contains a :class:`Density` instance blabla")
def density(self):
passwhich takes (But time's short so simple & fast is a virtue...) |
Towards #3261
Changes made in this Pull Request:
.densityin favour of.results.density.PR Checklist