Skip to content

Commit

Permalink
Document that TraitPrefixMap and TraitPrefixList are deprecated (#1702)
Browse files Browse the repository at this point in the history
TraitPrefixMap and TraitPrefixList were deprecated in Traits 6.1, and will be removed in Traits 7.0. This PR updates the docs to make that deprecation clearer.
  • Loading branch information
mdickinson committed Aug 10, 2022
1 parent 7ecd065 commit 11c6a87
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
2 changes: 0 additions & 2 deletions docs/source/traits_api_reference/trait_handlers.rst
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@ Private Functions
Deprecated Handlers
-------------------

.. deprecated:: 6.1.0

The following :class:`~.TraitHandler` classes and instances are deprecated,
and may be removed in a future version of Traits.

Expand Down
8 changes: 8 additions & 0 deletions docs/source/traits_user_manual/custom.rst
Original file line number Diff line number Diff line change
Expand Up @@ -468,6 +468,10 @@ the traits.trait_handlers module.
TraitPrefixList
```````````````

.. deprecated:: 6.1
:class:`~.TraitPrefixList` is scheduled for removal
in Traits 7.0. Use the :class:`~.PrefixList` trait type instead.

The TraitPrefixList handler accepts not only a specified set of strings as
values, but also any unique prefix substring of those values. The value assigned
to the trait attribute is the full string that the substring matches.
Expand Down Expand Up @@ -507,6 +511,10 @@ For example::
TraitPrefixMap
``````````````

.. deprecated:: 6.1
:class:`~.TraitPrefixMap` is scheduled for removal
in Traits 7.0. Use the :class:`~.PrefixMap` trait type instead.

The TraitPrefixMap handler combines the TraitPrefixList with mapped traits. Its
constructor takes a parameter that is a dictionary whose keys are strings. A
string is a valid value if it is a unique prefix for a key in the dictionary.
Expand Down
8 changes: 8 additions & 0 deletions traits/trait_handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -522,6 +522,10 @@ class TraitPrefixList(TraitHandler):
list of specified string values, or is a unique prefix of one of those
values.
.. deprecated:: 6.1
:class:`~.TraitPrefixList` is scheduled for removal in Traits
7.0. Use the :class:`~.PrefixList` trait type instead.
TraitPrefixList is a variation on TraitEnum. The values that can be
assigned to a trait attribute defined using a TraitPrefixList handler is
the set of all strings supplied to the TraitPrefixList constructor, as well
Expand Down Expand Up @@ -703,6 +707,10 @@ def get_editor(self, trait):
class TraitPrefixMap(TraitMap):
"""A cross between the TraitPrefixList and TraitMap classes.
.. deprecated:: 6.1
:class:`~.TraitPrefixMap` is scheduled for removal
in Traits 7.0. Use the :class:`~.PrefixMap` trait type instead.
Like TraitMap, TraitPrefixMap is created using a dictionary, but in this
case, the keys of the dictionary must be strings. Like TraitPrefixList,
a string *v* is a valid value for the trait attribute if it is a prefix of
Expand Down

0 comments on commit 11c6a87

Please sign in to comment.