Skip to content

Commit 8a232d0

Browse files
committed
Update README
1 parent 3d3e3e4 commit 8a232d0

File tree

1 file changed

+19
-6
lines changed

1 file changed

+19
-6
lines changed

README.rst

+19-6
Original file line numberDiff line numberDiff line change
@@ -69,35 +69,48 @@ Please note: it is not POSIX time but a time with
6969
undefined starting base, e.g. the time of the system power on.
7070

7171

72-
Context manager has ``.expired`` property for check if timeout happens
72+
Context manager has ``.expired()`` / ``.expired`` for check if timeout happens
7373
exactly in context manager::
7474

7575
async with timeout(1.5) as cm:
7676
await inner()
77-
print(cm.expired)
77+
print(cm.expired()) # recommended api
78+
print(cm.expired) # compatible api
7879

7980
The property is ``True`` if ``inner()`` execution is cancelled by
8081
timeout context manager.
8182

8283
If ``inner()`` call explicitly raises ``TimeoutError`` ``cm.expired``
8384
is ``False``.
8485

85-
The scheduled deadline time is available as ``.deadline`` property::
86+
The scheduled deadline time is available as ``.when()`` / ``.deadline``::
8687

8788
async with timeout(1.5) as cm:
88-
cm.deadline
89+
cm.when() # recommended api
90+
cm.deadline # compatible api
8991

90-
Not finished yet timeout can be rescheduled by ``shift_by()``
91-
or ``shift_to()`` methods::
92+
Not finished yet timeout can be rescheduled by ``shift()``
93+
or ``update()`` methods::
9294

9395
async with timeout(1.5) as cm:
96+
# recommended api
97+
cm.reschedule(cm.when() + 1) # add another second on waiting
98+
# compatible api
9499
cm.shift(1) # add another second on waiting
95100
cm.update(loop.time() + 5) # reschedule to now+5 seconds
96101

97102
Rescheduling is forbidden if the timeout is expired or after exit from ``async with``
98103
code block.
99104

100105

106+
Disable scheduled timeout::
107+
108+
async with timeout(1.5) as cm:
109+
cm.reschedule(None) # recommended api
110+
cm.reject() # compatible api
111+
112+
113+
101114
Installation
102115
------------
103116

0 commit comments

Comments
 (0)