-
Notifications
You must be signed in to change notification settings - Fork 441
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
Do not mutate scalar_ bar_args
#1357
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1357 +/- ##
=======================================
Coverage 90.06% 90.07%
=======================================
Files 58 58
Lines 12265 12267 +2
=======================================
+ Hits 11047 11049 +2
Misses 1218 1218 |
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.
Mostly musing or bikeshedding remarks. The only "hard" suggestion is the show()
removal in the tests. Apart from that I think this is great, so approving.
if "scalar" in kwargs: | ||
raise TypeError("`scalar` is an invalid keyword argument for `add_mesh`. Perhaps you mean `scalars` with an s?") | ||
assert_empty_kwargs(**kwargs) | ||
|
||
# Avoid mutating input | ||
if scalar_bar_args is None: | ||
scalar_bar_args = {} |
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 know this is unrelated to the PR, but I'm wondering if it makes sense that n_colors
is not set for add_volume
. It might not hurt to check that n_colors
affects the colorbar for add_mesh
.
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.
It would also be nice to extract out the common functionality for these things into a helper to make it consistent. I think this should be a different PR as it is about functionality (with a possibly breaking change) rather than fixing an unintended effect.
I'm merging this for the 0.31.0 release. For the record, two potential unresolved issues for future PRs. |
Overview
This PR copies
scalar_bar_args
to avoid mutating the passed in variable inadd_mesh
andadd_volume
.Fixes #1353
Details
Tests added for future regression testing.