@@ -106,12 +106,6 @@ def _make_options(x):
106
106
* an iterable of (label, value) pairs
107
107
* an iterable of values, and labels will be generated
108
108
"""
109
- # Check if x is a mapping of labels to values
110
- if isinstance (x , Mapping ):
111
- import warnings
112
- warnings .warn ("Support for mapping types has been deprecated and will be dropped in a future release." , DeprecationWarning )
113
- return tuple ((str (k ), v ) for k , v in x .items ())
114
-
115
109
# only iterate once through the options.
116
110
xlist = tuple (x )
117
111
@@ -132,10 +126,10 @@ def findvalue(array, value, compare = lambda x, y: x == y):
132
126
class _Selection (DescriptionWidget , ValueWidget , CoreWidget ):
133
127
"""Base class for Selection widgets
134
128
135
- ``options`` can be specified as a list of values, list of (label, value)
136
- tuples, or a dict of {label: value} . The labels are the strings that will be
137
- displayed in the UI, representing the actual Python choices, and should be
138
- unique. If labels are not specified, they are generated from the values.
129
+ ``options`` can be specified as a list of values or list of (label, value)
130
+ tuples. The labels are the strings that will be displayed in the UI,
131
+ representing the actual Python choices, and should be unique.
132
+ If labels are not specified, they are generated from the values.
139
133
140
134
When programmatically setting the value, a reverse lookup is performed
141
135
among the options to check that the value is valid. The reverse lookup uses
@@ -149,7 +143,7 @@ class _Selection(DescriptionWidget, ValueWidget, CoreWidget):
149
143
index = Int (None , help = "Selected index" , allow_none = True ).tag (sync = True )
150
144
151
145
options = Any ((),
152
- help = """Iterable of values, (label, value) pairs, or a mapping of {label: value} pairs that the user can select.
146
+ help = """Iterable of values or (label, value) pairs that the user can select.
153
147
154
148
The labels are the strings that will be displayed in the UI, representing the
155
149
actual Python choices, and should be unique.
@@ -183,9 +177,7 @@ def __init__(self, *args, **kwargs):
183
177
184
178
@validate ('options' )
185
179
def _validate_options (self , proposal ):
186
- # if an iterator is provided, exhaust it
187
- if isinstance (proposal .value , Iterable ) and not isinstance (proposal .value , Mapping ):
188
- proposal .value = tuple (proposal .value )
180
+ proposal .value = tuple (proposal .value )
189
181
# throws an error if there is a problem converting to full form
190
182
self ._options_full = _make_options (proposal .value )
191
183
return proposal .value
0 commit comments