Skip to content

Commit 0197258

Browse files
committed
doc fix
plus "fix"
1 parent ae9f847 commit 0197258

2 files changed

Lines changed: 10 additions & 7 deletions

File tree

docs/source/conf.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,15 @@
3434
("py:func", "trio_asyncio.run_future"),
3535
("py:func", "trio_asyncio.run_coroutine"),
3636
("py:func", "trio_asyncio.run_asyncio"),
37+
("py:func", "sniffio.current_async_library"),
3738
("py:class", "trio_asyncio.TrioEventLoop"),
3839
("py:class", "trio_asyncio.TrioExecutor"),
3940
("py:class", "trio_asyncio.TrioChildWatcher"),
4041
("py:meth", "trio_asyncio.TrioEventLoop.autoclose"),
4142
("py:meth", "trio_asyncio.TrioEventLoop.add_reader"),
4243
("py:meth", "trio_asyncio.TrioEventLoop.add_writer"),
4344
("py:meth", "trio_asyncio.sync.SyncTrioEventLoop.run_until_complete"),
45+
("py:mod", "trio_asyncio"), ## ???
4446
]
4547

4648
autodoc_inherit_docstrings = False
@@ -65,6 +67,7 @@
6567
intersphinx_mapping = {
6668
"python": ('https://docs.python.org/3', None),
6769
"trio": ('https://trio.readthedocs.io/en/stable', None),
70+
# "sniffio": ('https://sniffio.readthedocs.io/en/stable', None),
6871
}
6972

7073
autodoc_member_order = "bysource"

docs/source/usage.rst

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ After::
4545
trio_asyncio.run(async_main, *args)
4646

4747
Within ``async_main``, calls to :func:`asyncio.get_event_loop` will return
48-
the currently-running :class:`trio_asyncio:TrioEventLoop` instance. See
48+
the currently-running :class:`trio_asyncio.TrioEventLoop` instance. See
4949
:ref:`below <cross-calling>` on how to use it to actually call async code.
5050

5151
Equivalently, wrap your main loop (or any other code that needs to talk to
@@ -155,9 +155,9 @@ supported. You need to refactor your main loop. Broadly speaking, this
155155
means to replace::
156156

157157
async def setup():
158-
158+
pass # … do whatever
159159
async def shutdown():
160-
160+
pass # … do whatever
161161
loop.stop()
162162

163163
loop = asyncio.get_event_loop()
@@ -167,9 +167,9 @@ means to replace::
167167
with::
168168

169169
async def setup():
170-
170+
pass
171171
async def shutdown():
172-
172+
pass # … do whatever
173173
stopped_event.set()
174174

175175
async def async_main():
@@ -189,12 +189,12 @@ Detecting the loop context
189189

190190
Short answer: You don't want to.
191191

192-
Long answer: You either are running within a call to :func:`run_asyncio`,
192+
Long answer: You either are running within a call to :func:`trio_asyncio.run_asyncio`,
193193
or you don't. There is no "maybe" here, and you shouldn't indiscriminately
194194
call async code from both contexts – they have different semantics, esp.
195195
concerning cancellation.
196196

197-
If you really need to do this, :meth:`sniffio.current_async_library`
197+
If you really need to do this, :func:`sniffio.current_async_library`
198198
correctly reports "asyncio" when appropriate. (This requires Python 3.7
199199
for :mod:`contextvars` support in :mod:`asyncio`.
200200

0 commit comments

Comments
 (0)