Skip to content

Commit 772a64d

Browse files
committed
Better documentation for deprecated API.
1 parent fbccfe3 commit 772a64d

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

toyplot/canvas.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@
2525
class AnimationFrame(object):
2626
"""Used to specify modifications to a `toyplot.canvas.Canvas` during animation.
2727
28-
Do not create AnimationFrame instances yourself, an instance of
29-
AnimationFrame is automatically created by :meth:`toyplot.canvas.Canvas.animate`
30-
or :meth:`toyplot.canvas.Canvas.time` and passed to your callback.
28+
Do not create AnimationFrame instances yourself, use
29+
:meth:`toyplot.canvas.Canvas.frame` and
30+
:meth:`toyplot.canvas.Canvas.frames` instead.
3131
"""
3232
def __init__(self, changes, count, number, begin, end):
3333
self._changes = changes
@@ -37,6 +37,7 @@ def __init__(self, changes, count, number, begin, end):
3737
self._end = end
3838

3939
def index(self):
40+
"""Deprecated, use the `toyplot.canvas.AnimationFrame.number` property instead."""
4041
warnings.warn("toyplot.canvas.AnimationFrame.index() is deprecated, use the `number` property instead.", toyplot.DeprecationWarning, stacklevel=2)
4142
return self._number
4243

@@ -59,6 +60,7 @@ def begin(self):
5960
return self._begin
6061

6162
def time(self):
63+
"""Deprecated, use the `toyplot.canvas.AnimationFrame.begin` property instead."""
6264
warnings.warn("toyplot.canvas.AnimationFrame.time() is deprecated, use the `begin` property instead.", toyplot.DeprecationWarning, stacklevel=2)
6365
return self._begin
6466

@@ -75,6 +77,7 @@ def length(self):
7577
return self._end - self._begin
7678

7779
def duration(self):
80+
"""Deprecated, use the `toyplot.canvas.AnimationFrame.length` property instead."""
7881
warnings.warn("toyplot.canvas.AnimationFrame.duration() is deprecated, use the `length` property instead.", toyplot.DeprecationWarning, stacklevel=2)
7982
return self.length
8083

@@ -340,14 +343,16 @@ def frames(self, frames):
340343

341344

342345
def animate(self, frames, callback=None):
343-
warnings.warn("toyplot.canvas.animate() is deprecated, use frames() instead.", toyplot.DeprecationWarning, stacklevel=2)
346+
"""Deprecated, use :func:`toyplot.canvas.Canvas.frames` instead."""
347+
warnings.warn("toyplot.canvas.Canvas.animate() is deprecated, use frames() instead.", toyplot.DeprecationWarning, stacklevel=2)
344348

345349
for frame in self.frames(frames):
346350
if callback:
347351
callback(frame)
348352

349353

350354
def time(self, begin, end, number=None, count=None):
355+
"""Deprecated, use :func:`toyplot.canvas.Canvas.frame` instead."""
351356
warnings.warn("toyplot.canvas.Canvas.time() is deprecated, use frame() instead.", toyplot.DeprecationWarning, stacklevel=2)
352357
return self.frame(begin=begin, end=end, number=number, count=count)
353358

0 commit comments

Comments
 (0)