-
Notifications
You must be signed in to change notification settings - Fork 416
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
Copy method for declarative interface #1884
Merged
dopplershift
merged 1 commit into
Unidata:main
from
23ccozad:copy_method_declarative_interface
May 26, 2021
Merged
Copy method for declarative interface #1884
dopplershift
merged 1 commit into
Unidata:main
from
23ccozad:copy_method_declarative_interface
May 26, 2021
Conversation
This file contains 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
dopplershift
requested changes
May 25, 2021
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.
Overall, this looks great. Just a few minor clean-ups. There is the question of whether we can do more in testing that our copies are actually copying some trait values across
dopplershift
added
Area: Plots
Pertains to producing plots
Type: Enhancement
Enhancement to existing functionality
labels
May 25, 2021
23ccozad
commented
May 25, 2021
23ccozad
force-pushed
the
copy_method_declarative_interface
branch
from
May 25, 2021 21:20
d4363d5
to
0eed012
Compare
MapPanel needed an explicity written __copy__() to make sure the copy process worked correctly. All other classes in declarative.py did not need it. A .copy() method is also provided for ease of use.
23ccozad
force-pushed
the
copy_method_declarative_interface
branch
from
May 25, 2021 21:31
0eed012
to
8d0b963
Compare
dopplershift
approved these changes
May 26, 2021
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
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.
Description Of Changes
Adds a
.copy()
method to just about every class indeclarative.py
. This includesPlots2D
(and hence all of its subclasses),MapPanel
,PanelContainer
, andPlotObs
. The only class excluded isPanel
, since it is currently empty.This
obj.copy()
is equivalent to usingimport copy
andcopy.copy(obj)
, except whenobj
is a MapPanel.The
.copy()
method for MapPanel required some additional changes in order to get it working. @dopplershift and I found that we needed to setallow_none=True
for theparent
trait ofMapPanel
in order to accommodate the process of copying a MapPanel that may not have been assigned a parent yet. A__copy__()
method was written explicitly for MapPanel since a deeper copy of MapPanel'splots
trait is needed in order for the copy to work correctly.Test function
test_copy()
was added intest_declarative.py
Checklist