-
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
Clean up PrefixList and PrefixMap #1564
Conversation
traits/trait_types.py
Outdated
@@ -3141,7 +3156,7 @@ class Map(TraitType): | |||
|
|||
The following example defines a ``Person`` class:: | |||
|
|||
>>> class Person(HasTraits): | |||
>>> erson(HasTraits): |
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.
Something odd has happened to this line.
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.
Thanks; should be fixed in e2435a5.
traits/trait_types.py
Outdated
@@ -3316,7 +3348,7 @@ def post_setattr(self, object, name, value): | |||
setattr(object, name + "_", self.mapped_value(value)) | |||
|
|||
def info(self): | |||
keys = sorted(repr(x) for x in self.map.keys()) | |||
keys = sorted(repr(x) for x in self.map) |
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.
There's a difference between PrefixList
and PrefixMap
here: we sort the output for PrefixMap
but not PrefixList
. Given that we can now rely on ordered dictionaries, I think we should drop the sorted
here.
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.
One issue (fixed in e2435a5), otherwise LGTM.
…ap2' into cleanup/prefix-list-and-prefix-map2
This PR does some refactoring and cleanup on the
PrefixList
andPrefixMap
trait types. It's a more careful re-invention of the changes in #1563 (extended toPrefixMap
).Principal user-facing changes:
ValueError
rather thanTraitError
.default_value
is now explicit in the trait type signature, rather than being extracted from the metadata. (This doesn't change any behaviour, but does improve the documentation and discoverability.)Fixes #955.
Fixes issues described in #1561.