mirror of https://github.com/flaggo/pydu.git
fix func name error in misc doc
This commit is contained in:
parent
8cfdf717d3
commit
64db2e00cc
|
@ -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)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue