Skip to content

Commit 5f760c9

Browse files
committed
Minor doc improvements.
1 parent e6208b4 commit 5f760c9

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

PRIMITIVES.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -562,8 +562,8 @@ Public bound method:
562562
* `__call__` This returns the coro and is used to schedule the task using the
563563
event loop `create_task()` method using function call syntax.
564564

565-
The `StopTask` exception is an alias for `usayncio.CancelledError`. In my view
566-
the name is more descriptive of its function.
565+
The `asyn.StopTask` exception is an alias for `usayncio.CancelledError`. In my
566+
view the name is more descriptive of its function.
567567

568568
### 4.2.1 Groups
569569

@@ -579,12 +579,12 @@ A task created with the `cancellable` decorator can intercept the `StopTask`
579579
exception to perform custom cleanup operations. This may be done as below:
580580

581581
```python
582-
@cancellable
582+
@asyn.cancellable
583583
async def foo():
584584
while True:
585585
try:
586586
await sleep(1) # Main body of task
587-
except StopTask:
587+
except asyn.StopTask:
588588
# perform custom cleanup
589589
return # Respond by quitting
590590
```
@@ -593,11 +593,11 @@ The following example returns `True` if it ends normally or `False` if
593593
cancelled.
594594

595595
```python
596-
@cancellable
596+
@asyn.cancellable
597597
async def bar():
598598
try:
599599
await sleep(1) # Main body of task
600-
except StopTask:
600+
except asyn.StopTask:
601601
return False
602602
else:
603603
return True
@@ -697,11 +697,11 @@ if necessary. This might be done for cleanup or to return a 'cancelled' status.
697697
The coro should have the following form:
698698

699699
```python
700-
@cancellable
700+
@asyn.cancellable
701701
async def foo():
702702
try:
703703
await asyncio.sleep(1) # User code here
704-
except StopTask:
704+
except asyn.StopTask:
705705
return False # Cleanup code
706706
else:
707707
return True # Normal exit
@@ -716,7 +716,7 @@ latest API changes are:
716716
* `NamedTask.cancel()` is now asynchronous.
717717
* `NamedTask` and `Cancellable` coros no longer receive a `TaskId` instance as
718718
their 1st arg.
719-
* `@namedtask` still works but is now an alias for `@cancellable`.
719+
* `@asyn.namedtask` still works but is now an alias for `@asyn.cancellable`.
720720

721721
The drive to simplify code comes from the fact that `uasyncio` is itself under
722722
development. Tracking changes is an inevitable headache.

0 commit comments

Comments
 (0)