-
Notifications
You must be signed in to change notification settings - Fork 85
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
Fix TraitType clone default values #1645
Conversation
These should fail initially.
This intends to be deliberate about what needs to be done for different DefaultValue types. Some of the tests will still fail after this is added.
This is safe because the clone method on the trait type now correctly sets up default values.
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 LGTM, and I strongly agree that getting rid of the specialization in has_traits.py
and having the trait types be responsible for doing The Right Thing is the way to go. A few comments, mostly at nitpick level.
@corranwebster I think this is ready to go in. Any last thoughts before I merge? |
I'm good with the changes. |
Thanks! Merging. |
This PR works towards a fix of #1630 and related issues. The starting point is a set of regression tests that identify the behaviour which doesn't seem correct and test for the expected behaviour. This then adds changes to TraitTypes.clone that fix a number of the observed issues. We then remove the default value wrangling in HasTraits as it should no longer be needed. I think at this point everything is in a better state than it was: we have less unexpected behaviour. There may be subsequent things which might be advisable, such as raising warnings about future deprecation of certain behaviours, adding clone methods to particular trait types, etc. Co-authored-by: Mark Dickinson <[email protected]> (cherry picked from commit 7ecd065)
This is a draft PR working towards a fix of #1630 and related issues.
The starting point is a set of regression tests that identify the behaviour which doesn't seem correct and test for the expected behaviour. This then adds changes to
TraitTypes.clone
that fix a number of the observed issues. We then remove the default value wrangling inHasTraits
as it should no longer be needed.I think at this point everything is in a better state than it was: we have less unexpected behaviour.
There may be subsequent things which might be advisable, such as raising warnings about future deprecation of certain behaviours, adding
clone
methods to particular trait types, etc.Checklist
docs/source/traits_api_reference
)docs/source/traits_user_manual
)Update type annotation hints intraits-stubs