|
26 | 26 |
|
27 | 27 | ### async_basics: Basics |
28 | 28 | # Use :meth:`Connection.as_async` to get an async connection, and |
29 | | -# async for to iterate results. We also apply :doc:`best practice |
30 | | -# <bestpractice>` and use :func:`contextlib.aclosing` to ensure the |
31 | | -# database is closed while the event loop is still running. |
| 29 | +# :code:`async for` to iterate results. We also apply :doc:`best |
| 30 | +# practice <bestpractice>` and use :func:`contextlib.aclosing` to |
| 31 | +# ensure the database is closed. |
32 | 32 |
|
33 | 33 | apsw.bestpractice.apply(apsw.bestpractice.recommended) |
34 | 34 |
|
@@ -132,12 +132,14 @@ async def callbacks(): |
132 | 132 | # any fail, then cancel uncompleted ones, and raise the resulting |
133 | 133 | # exceptions. |
134 | 134 | # |
135 | | -# * :external+python:ref:`except * <except_star>` and |
136 | | -# :class:`ExceptionGroup` Python syntax for catching multiple |
137 | | -# exceptions such as from a group of tasks |
138 | | -# * :class:`asyncio.TaskGroup` |
139 | | -# * :external+trio:ref:`Trio tasks <tasks>` |
140 | | -# * :external+anyio:doc:`AnyIO tasks <tasks>` |
| 135 | +# .. seealso:: |
| 136 | +# |
| 137 | +# * :external+python:ref:`except * <except_star>` and |
| 138 | +# :class:`ExceptionGroup` - Python syntax for catching multiple |
| 139 | +# exceptions such as from a group of tasks |
| 140 | +# * :class:`asyncio.TaskGroup` |
| 141 | +# * :external+trio:ref:`Trio tasks <tasks>` |
| 142 | +# * :external+anyio:doc:`AnyIO tasks <tasks>` |
141 | 143 | # |
142 | 144 | # This example shows asyncio, but the principles are the same across |
143 | 145 | # all the frameworks. |
@@ -231,15 +233,17 @@ async def deliberate_error(): |
231 | 233 | # deadlines for each framework, getting their current time, and |
232 | 234 | # exceptions raised on timeout. |
233 | 235 | # |
234 | | -# * :meth:`asyncio.get_running_loop().time() <asyncio.loop.time>` |
235 | | -# * :exc:`TimeoutError` |
236 | | -# * :exc:`trio.TooSlowError` |
237 | | -# * :func:`trio.current_time` |
238 | | -# * :func:`trio.current_effective_deadline` |
239 | | -# * :func:`trio.fail_after` :func:`trio.fail_at` |
240 | | -# * :func:`anyio.current_time` |
241 | | -# * :func:`anyio.current_effective_deadline` |
242 | | -# * :func:`anyio.fail_after` |
| 236 | +# .. seealso:: |
| 237 | +# |
| 238 | +# * :meth:`asyncio.get_running_loop().time() <asyncio.loop.time>` |
| 239 | +# * :exc:`TimeoutError` |
| 240 | +# * :exc:`trio.TooSlowError` |
| 241 | +# * :func:`trio.current_time` |
| 242 | +# * :func:`trio.current_effective_deadline` |
| 243 | +# * :func:`trio.fail_after` :func:`trio.fail_at` |
| 244 | +# * :func:`anyio.current_time` |
| 245 | +# * :func:`anyio.current_effective_deadline` |
| 246 | +# * :func:`anyio.fail_after` |
243 | 247 |
|
244 | 248 |
|
245 | 249 | # The query is not reproduced here but is used when running this |
@@ -409,7 +413,7 @@ async def virtual_tables(): |
409 | 413 | ): |
410 | 414 | print(row) |
411 | 415 |
|
412 | | - # SQLite will do the query work |
| 416 | + # SQLite will figure out the review and order work |
413 | 417 | async for row in await db.execute( |
414 | 418 | "SELECT * FROM books WHERE server=? AND flags=?AND review > 9.55 " |
415 | 419 | " ORDER BY year DESC", |
|
0 commit comments