Closed mdickinson closed 2 years ago
Actually, let me do at least a little bit of cleanup in the __init__
method.
Actually, let me do at least a little bit of cleanup in the
__init__
method.
Done.
Sorry, @rahulporuri. In case it wasn't clear, I'm done tinkering with this PR. (There's lots more I'd love to do given time, but I don't have that time right now, and this seems like it should be enough for the bugfix.)
This PR rewrites
RevPrefixMap
to inherit directly fromTraitType
rather than subclassingPrefixMap
. This reduces the fragility ofRevPrefixMap
with respect to future upstream changes toPrefixMap
.To get to this code, I simply pasted in the Traits 6.2.0 version of
PrefixMap
under a new nameOldPrefixMap
to remove the dependence on upstream, and then refactored to collapse theRevPrefixMap -> OldPrefixMap -> TraitType
inheritance tree toRevPrefixMap -> TraitType
.I've added some extra tests, to be sure that I didn't break existing behaviour while refactoring.
There are plenty of further cleanup and refactoring opportunities in
RevPrefixMap
(particularly in the__init__
and with the duplication betweenvalue_for
andvalidate
), but those are probably best left to the next minor feature release. I'm hoping that this PR can go into the 4.7.4 bugfix release.Fixes #1094.