fix func name error in misc doc

This commit is contained in:
Prodesire 2017-12-14 20:10:06 +08:00
parent 8cfdf717d3
commit 64db2e00cc
1 changed files with 3 additions and 5 deletions

View File

@ -1,25 +1,23 @@
Miscellanea Miscellanea
----------- -----------
.. py:function:: pydu.misc.unix_timeout(seconds) .. py:function:: pydu.misc.timeout(seconds)
This func decorates any func which may be hang for a while. The param ``seconds`` This func decorates any func which may be hang for a while. The param ``seconds``
should be integer. can be either integer or float.
In `test.py`, you may write like below: In `test.py`, you may write like below:
.. code-block:: python .. code-block:: python
import time import time
from pydu.misc import unix_timeout from pydu.misc import unix_timeout
@unix_timeout(1) @timeout(1)
def f(): def f():
time.sleep(1.01) time.sleep(1.01)
f() f()
And run `test.py`, will see ``TimeoutError``. And run `test.py`, will see ``TimeoutError``.
.. note:: ``unix_timeout`` can only be used on ``unix-like`` system.
.. py:function:: pydu.misc.trace(obj) .. py:function:: pydu.misc.trace(obj)