ENH: Resetable Funcified Methods#385
Merged
Gui-FernandesBR merged 7 commits intoenh/liquid-motorsfrom Jun 30, 2023
Merged
Conversation
phmbressan
approved these changes
Jun 28, 2023
MateusStano
reviewed
Jun 28, 2023
MateusStano
reviewed
Jun 28, 2023
MateusStano
reviewed
Jun 28, 2023
Update rocketpy/Function.py Co-authored-by: MateusStano <69485049+MateusStano@users.noreply.github.com>
Update rocketpy/Function.py Co-authored-by: phmbressan <87212571+phmbressan@users.noreply.github.com>
Member
|
For future reference, here are the classes that could start using this resetable function:
|
Gui-FernandesBR
approved these changes
Jun 30, 2023
Member
Gui-FernandesBR
left a comment
There was a problem hiding this comment.
Great fix, many thanks @giovaniceotto !
I hereby confirm that I've tested in the notebooks and it was running perfectly.
Before the v1.0.0 we should definitely apply this reset feature to other classes too.
Member
Author
|
Thanks for all the feedbacks. @Gui-FernandesBR, I have added the new method to the I believe all the concerns have already been thoroughly discussed and addressed. Feel free to merge. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pull request type
Please check the type of change your PR introduces:
Pull request checklist
Please check if your PR fulfills the following requirements, depending on the type of PR:
Code base additions (for bug fixes / features):
black rocketpy) has passed locally and any fixes were madepytest --runslow) have passed locallyWhat is the current behavior?
All methods that use the
funcify_methoddecorator from the Function class are cached. Once an underlying quantity that effects the value of these funcified methods is changed, they cannot be easily updated to incorporate the changes made to the class instance.What is the new behavior?
A simple function called
reset_funcified_methodshas been created in the Function module. It can be imported by any multable class which makes use of thefuncify_methoddecorator.Both
HybridMotorsandLiquidMotorshave been updated to incorporate the functionreset_funcified_methodsin end of their ´addTank´ method.Does this introduce a breaking change?
Other information
This can be further incorporated in other parts of the code if judged as a good implementation.
This PR does not consider resetting cached properties. In a simple understanding, such methods can be decorated simply by
@propertyinstead of@cached_property. If caching is still useful, a similar approach to what was implemented in thereset_funcified_methodscan be done to provide the desired functionality.