Skip to content

Commit

Permalink
remove old deprecation warning (#298)
Browse files Browse the repository at this point in the history
  • Loading branch information
tlambert03 committed Oct 10, 2021
1 parent 77ba542 commit e645991
Showing 1 changed file with 0 additions and 26 deletions.
26 changes: 0 additions & 26 deletions magicgui/type_map.py
Original file line number Diff line number Diff line change
Expand Up @@ -361,10 +361,6 @@ def _deco(type_):
_options = cast(WidgetOptions, options)

if "choices" in _options:
_choices = _options["choices"]

if not isinstance(_choices, EnumMeta) and callable(_choices):
_options["choices"] = _check_choices(_choices)
_TYPE_DEFS[_type_] = (widgets.ComboBox, _options)
if widget_type is not None:
warnings.warn(
Expand All @@ -389,28 +385,6 @@ def _deco(type_):
return _deco if type_ is None else _deco(type_)


def _check_choices(choices):
"""Catch pre 0.2.0 API from developers using register_type."""
n_params = len(inspect.signature(choices).parameters)
if n_params > 1:
warnings.warn(
"\n\nDEVELOPER NOTICE: As of magicgui 0.2.0, when providing a callable to "
"`choices`, the\ncallable may accept only a single positional "
"argument (which will be an instance of\n"
"`magicgui.widgets._bases.CategoricalWidget`), and must "
"return an iterable (the choices\nto show). Function "
f"'{choices.__module__}.{choices.__name__}' accepts {n_params} "
"arguments.\nIn the future, this will raise an exception.\n",
DeprecationWarning,
)

def wrapper(obj):
return choices(obj.native, obj.annotation)

return wrapper
return choices


def _type2callback(type_: type) -> list[ReturnCallback]:
"""Check if return callbacks have been registered for ``type_`` and return if so.
Expand Down

0 comments on commit e645991

Please sign in to comment.