@@ -214,8 +214,8 @@ def _pick_widget_type(
214214 raise_on_unknown : bool = True ,
215215) -> WidgetTuple :
216216 """Pick the appropriate widget type for ``value`` with ``annotation``."""
217- annotation , _options = _split_annotated_type (annotation )
218- options = {** _options , ** (options or {})}
217+ annotation , options_ = _split_annotated_type (annotation )
218+ options = {** options_ , ** (options or {})}
219219 choices = options .get ("choices" )
220220
221221 if is_result and annotation is inspect .Parameter .empty :
@@ -229,9 +229,9 @@ def _pick_widget_type(
229229 ):
230230 return widgets .EmptyWidget , {"visible" : False , ** options }
231231
232- _type , optional = _type_optional (value , annotation )
232+ type_ , optional = _type_optional (value , annotation )
233233 options .setdefault ("nullable" , optional )
234- choices = choices or (isinstance (_type , EnumMeta ) and _type )
234+ choices = choices or (isinstance (type_ , EnumMeta ) and type_ )
235235 literal_choices , nullable = _literal_choices (annotation )
236236 if literal_choices is not None :
237237 choices = literal_choices
@@ -243,7 +243,7 @@ def _pick_widget_type(
243243 if widget_type == "RadioButton" :
244244 widget_type = "RadioButtons"
245245 warnings .warn (
246- f"widget_type of 'RadioButton' (with dtype { _type } ) is"
246+ f"widget_type of 'RadioButton' (with dtype { type_ } ) is"
247247 " being coerced to 'RadioButtons' due to choices or Enum type." ,
248248 stacklevel = 2 ,
249249 )
@@ -252,15 +252,15 @@ def _pick_widget_type(
252252
253253 # look for subclasses
254254 for registered_type in _TYPE_DEFS :
255- if _type == registered_type or safe_issubclass (_type , registered_type ):
256- _cls , opts = _TYPE_DEFS [registered_type ]
257- return _cls , {** options , ** opts }
255+ if type_ == registered_type or safe_issubclass (type_ , registered_type ):
256+ cls_ , opts = _TYPE_DEFS [registered_type ]
257+ return cls_ , {** options , ** opts }
258258
259259 if is_result :
260- _widget_type = match_return_type (_type )
261- if _widget_type :
262- _cls , opts = _widget_type
263- return _cls , {** options , ** opts }
260+ widget_type_ = match_return_type (type_ )
261+ if widget_type_ :
262+ cls_ , opts = widget_type_
263+ return cls_ , {** opts , ** options }
264264 # Chosen for backwards/test compatibility
265265 return widgets .LineEdit , {"gui_only" : True }
266266
@@ -269,14 +269,14 @@ def _pick_widget_type(
269269 wdg = widgets .Select if options .get ("allow_multiple" ) else widgets .ComboBox
270270 return wdg , options
271271
272- _widget_type = match_type (_type , value )
273- if _widget_type :
274- _cls , opts = _widget_type
275- return _cls , {** options , ** opts }
272+ widget_type_ = match_type (type_ , value )
273+ if widget_type_ :
274+ cls_ , opts = widget_type_
275+ return cls_ , {** opts , ** options }
276276
277277 if raise_on_unknown :
278278 raise ValueError (
279- f"No widget found for type { _type } and annotation { annotation !r} "
279+ f"No widget found for type { type_ } and annotation { annotation !r} "
280280 )
281281
282282 options ["visible" ] = False
@@ -328,7 +328,7 @@ def get_widget_class(
328328 The WidgetClass, and dict that can be used for params. dict
329329 may be different than the options passed in.
330330 """
331- widget_type , _options = _pick_widget_type (
331+ widget_type , options_ = _pick_widget_type (
332332 value , annotation , options , is_result , raise_on_unknown
333333 )
334334
@@ -340,7 +340,7 @@ def get_widget_class(
340340 if not safe_issubclass (widget_class , widgets .bases .Widget ):
341341 assert_protocol (widget_class , WidgetProtocol )
342342
343- return widget_class , _options
343+ return widget_class , options_
344344
345345
346346def _import_wdg_class (class_name : str ) -> WidgetClass :
0 commit comments