Fix with_timeout documentation
Lists cannot be passed as the trigger.
Also strip trailing spaces.
@@ -770,7 +770,7 @@ class ClockCycles(Waitable):
@decorators.coroutine
-def with_timeout(triggers, timeout_time, timeout_unit=None):
+def with_timeout(trigger, timeout_time, timeout_unit=None):
"""
Waits on triggers, throws an exception if it waits longer than the given time.
@@ -779,11 +779,11 @@ def with_timeout(triggers, timeout_time, timeout_unit=None):
.. code-block:: python
yield with_timeout(coro, 100, 'ns')
- yield with_timeout([coro, event.wait(), ...], 100, 'ns')
+ yield with_timeout(First(coro, event.wait()), 100, 'ns')
Args:
- triggers (cocotb_yield_expr):
- Any expression that could be right of a :keyword:`yield`
+ trigger (cocotb_waitable):
+ A single object that could be right of a :keyword:`yield`
(or :keyword:`await` in Python 3) expression in cocotb.
timeout_time (numbers.Real or decimal.Decimal):
Time duration.
@@ -799,7 +799,7 @@ def with_timeout(triggers, timeout_time, timeout_unit=None):
.. versionadded:: 1.3
"""
timeout_timer = cocotb.triggers.Timer(timeout_time, timeout_unit)
- res = yield [timeout_timer, triggers]
+ res = yield [timeout_timer, trigger]
if res is timeout_timer:
raise cocotb.result.SimTimeoutError
else:
