Skip to content

Commit 372457b

Browse files
committed
Remove deprecated annotation support
See #1292
1 parent f9a13db commit 372457b

File tree

2 files changed

+0
-114
lines changed

2 files changed

+0
-114
lines changed

ipywidgets/widgets/interaction.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -117,15 +117,11 @@ def _yield_abbreviations_for_parameter(param, kwargs):
117117
"""Get an abbreviation for a function parameter."""
118118
name = param.name
119119
kind = param.kind
120-
ann = param.annotation
121120
default = param.default
122121
not_found = (name, empty, empty)
123122
if kind in (Parameter.POSITIONAL_OR_KEYWORD, Parameter.KEYWORD_ONLY):
124123
if name in kwargs:
125124
value = kwargs.pop(name)
126-
elif ann is not empty:
127-
warn("Using function annotations to implicitly specify interactive controls is deprecated. Use an explicit keyword argument for the parameter instead.", DeprecationWarning)
128-
value = ann
129125
elif default is not empty:
130126
value = default
131127
else:

ipywidgets/widgets/tests/test_interaction.py

Lines changed: 0 additions & 110 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
from traitlets import TraitError
1515
from ipywidgets import (interact, interact_manual, interactive,
1616
interaction, Output)
17-
from ipython_genutils.py3compat import annotate
1817

1918
#-----------------------------------------------------------------------------
2019
# Utility stuff
@@ -277,115 +276,6 @@ def items(self):
277276
)
278277
check_widgets(c, lis=d)
279278

280-
281-
def test_defaults():
282-
@annotate(n=10)
283-
def f(n, f=4.5, g=1):
284-
pass
285-
286-
c = interactive(f)
287-
check_widgets(c,
288-
n=dict(
289-
cls=widgets.IntSlider,
290-
value=10,
291-
),
292-
f=dict(
293-
cls=widgets.FloatSlider,
294-
value=4.5,
295-
),
296-
g=dict(
297-
cls=widgets.IntSlider,
298-
value=1,
299-
),
300-
)
301-
302-
def test_default_values():
303-
@annotate(n=10, f=(0, 10.), g=5, h=OrderedDict([('a',1), ('b',2)]), j=['hi', 'there'])
304-
def f(n, f=4.5, g=1, h=2, j='there'):
305-
pass
306-
307-
c = interactive(f)
308-
check_widgets(c,
309-
n=dict(
310-
cls=widgets.IntSlider,
311-
value=10,
312-
),
313-
f=dict(
314-
cls=widgets.FloatSlider,
315-
value=4.5,
316-
),
317-
g=dict(
318-
cls=widgets.IntSlider,
319-
value=5,
320-
),
321-
h=dict(
322-
cls=widgets.Dropdown,
323-
options=OrderedDict([('a',1), ('b',2)]),
324-
value=2
325-
),
326-
j=dict(
327-
cls=widgets.Dropdown,
328-
options=('hi', 'there'),
329-
value='there'
330-
),
331-
)
332-
333-
def test_default_out_of_bounds():
334-
@annotate(f=(0, 10.), h={'a': 1}, j=['hi', 'there'])
335-
def f(f='hi', h=5, j='other'):
336-
pass
337-
338-
c = interactive(f)
339-
check_widgets(c,
340-
f=dict(
341-
cls=widgets.FloatSlider,
342-
value=5.,
343-
),
344-
h=dict(
345-
cls=widgets.Dropdown,
346-
options={'a': 1},
347-
value=1,
348-
),
349-
j=dict(
350-
cls=widgets.Dropdown,
351-
options=('hi', 'there'),
352-
value='hi',
353-
),
354-
)
355-
356-
def test_annotations():
357-
@annotate(n=10, f=widgets.FloatText())
358-
def f(n, f):
359-
pass
360-
361-
c = interactive(f)
362-
check_widgets(c,
363-
n=dict(
364-
cls=widgets.IntSlider,
365-
value=10,
366-
),
367-
f=dict(
368-
cls=widgets.FloatText,
369-
),
370-
)
371-
372-
def test_priority():
373-
@annotate(annotate='annotate', kwarg='annotate')
374-
def f(kwarg='default', annotate='default', default='default'):
375-
pass
376-
377-
c = interactive(f, kwarg='kwarg')
378-
check_widgets(c,
379-
kwarg=dict(
380-
cls=widgets.Text,
381-
value='kwarg',
382-
),
383-
annotate=dict(
384-
cls=widgets.Text,
385-
value='annotate',
386-
),
387-
)
388-
389279
def test_decorator_kwarg(clear_display):
390280
with patch.object(interaction, 'display', record_display):
391281
@interact(a=5)

0 commit comments

Comments
 (0)