Add __reduce__ to Body class#1443
Conversation
Codecov Report
@@ Coverage Diff @@
## main #1443 +/- ##
=======================================
Coverage 91.83% 91.84%
=======================================
Files 95 95
Lines 4448 4450 +2
Branches 430 430
=======================================
+ Hits 4085 4087 +2
Misses 273 273
Partials 90 90
Continue to review full report at Codecov.
|
astrojuanlu
left a comment
There was a problem hiding this comment.
Looks like __reduce__ accepts either a string, and that it's the right thing to do in this case:
If a string is returned, the string should be interpreted as the name of a global variable. It should be the object’s local name relative to its module; the pickle module searches the module namespace to determine the object’s module. This behaviour is typically useful for singletons.
https://docs.python.org/3/library/pickle.html#object.__reduce__
So, this solution is good! But it needs a test 😄
for more information, see https://pre-commit.ci
|
I used the |
This change does seem to solve the problem mentioned in #1395.

__reduce__returns a string, which I think is commonly done for singleton classes. As a result, I was able to get the plot:Just wondering if this is really a solution to the issue...