-
-
Notifications
You must be signed in to change notification settings - Fork 553
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
[Bug]: pybamm.Simulation.set_parameters
and pybamm.Simulation.set_up_and_parameterise_experiment
made private in simulation.py
#4489
[Bug]: pybamm.Simulation.set_parameters
and pybamm.Simulation.set_up_and_parameterise_experiment
made private in simulation.py
#4489
Conversation
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 think the other question for this is what we do about the function names and tests.
Improvements:
I think that if we intend to deprecate the public functions we should:
- First rename all the usages to
_set_parameters()
and_set_up_and_parameterise_experiment()
- Create new functions called
set_parameters()
andsetup_and_parametrise_experiments()
- The new functions should be more like this
def set_parameters(...): msg = "pybamm.simulation.set_parameters() is deprecated" warnings,warn(msg, DeprecationWarning, stacklevel=2) self._set_parameters(...)
The renaming is done first so you make sure to catch all usages in the codebase before adding the new one.
Problems:
- The tests use these functions, so this means that we will be accessing private members outside the class.
- In the future I would like to turn on inspections to prevent accessing private methods. This becomes a problem if the tests need to access these methods.
- We should find a solution to having the tests access these members.
…l-Sharma30/PyBaMM into simulation_function_private
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #4489 +/- ##
===========================================
- Coverage 99.26% 99.25% -0.02%
===========================================
Files 302 302
Lines 22889 22897 +8
===========================================
+ Hits 22721 22726 +5
- Misses 168 171 +3 ☔ View full report in Codecov by Sentry. 🚨 Try these New Features:
|
@Akhil-Sharma30 I just fixed a couple small things, should be good for now |
Description
pybamm.Simulation.set_parameters
,pybamm.Simulation.set_up_and_parameterise_experiment
andpybamm.Simulation.set_up_and_parameterise_model_for_experiment
made private inpybamm/simulation.py
(continuation of #3752 PR)
Fixes #3751
Type of change
Please add a line in the relevant section of CHANGELOG.md to document the change (include PR #) - note reverse order of PR #s. If necessary, also add to the list of breaking changes.
Key checklist:
$ pre-commit run
(or$ nox -s pre-commit
) (see CONTRIBUTING.md for how to set this up to run automatically when committing locally, in just two lines of code)$ python run-tests.py --all
(or$ nox -s tests
)$ python run-tests.py --doctest
(or$ nox -s doctests
)You can run integration tests, unit tests, and doctests together at once, using
$ python run-tests.py --quick
(or$ nox -s quick
).Further checks: