Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix docs build #348

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 11 additions & 6 deletions docs/customization.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
# Adapted from https://hg.python.org/cpython/file/default/Doc/tools/extensions/pyspecific.py .

from sphinx import addnodes
from sphinx.domains.python import PyModulelevel, PyClassmember
from sphinx import addnodes, __version__

if tuple(map(int,__version__.split('.'))) >= (4, 0, 0):
from sphinx.domains.python import PyAttribute, PyFunction
else:
from sphinx.domains.python import PyModulelevel, PyClassmember
PyFunction, PyAttribute = PyModulelevel, PyClassmember


class PyCoroutineMixin(object):
Expand All @@ -12,18 +17,18 @@ def handle_signature(self, sig, signode):
return ret


class PyAsyncFunction(PyCoroutineMixin, PyModulelevel):
class PyAsyncFunction(PyCoroutineMixin, PyFunction):

def run(self):
self.name = 'py:function'
return PyModulelevel.run(self)
return PyFunction.run(self)


class PyAsyncMethod(PyCoroutineMixin, PyClassmember):
class PyAsyncMethod(PyCoroutineMixin, PyAttribute):

def run(self):
self.name = 'py:method'
return PyClassmember.run(self)
return PyAttribute.run(self)


def setup(app):
Expand Down
1 change: 1 addition & 0 deletions docs/reference.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1390,6 +1390,7 @@ The following functions are also available. They accept the same arguments as t
equivalents in the :mod:`subprocess` module:

.. asyncfunction:: run(args, stdin=None, input=None, stdout=None, stderr=None, shell=False, check=False)
:noindex:

Run a command in a subprocess. Returns a :class:`subprocess.CompletedProcess` instance.
If cancelled, the underlying process is terminated using the process ``kill()`` method.
Expand Down
22 changes: 16 additions & 6 deletions docs/tutorial.rst
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,9 @@ This program does two things at once::
curio.run(parent)

``curio.spawn()`` launches a concurrent task. The ``join()`` method waits
for it to finish and returns its result. The following output is produced::
for it to finish and returns its result. The following output is produced:

.. code-block:: console

bash % python3 hello.py
Getting around to doing my homework
Expand Down Expand Up @@ -141,7 +143,9 @@ Likewise, cancellation can be caught. For example::
print("No go diggy die!")
raise

Now the program produces this output::
Now the program produces this output:

.. code-block:: console

bash % python3 hello.py
Getting around to doing my homework
Expand All @@ -153,7 +157,7 @@ Now the program produces this output::
Are you done yet?
We've got to go!
No go diggy die!
bash %
bash %

This is the basic gist of tasks. You can create
tasks, join tasks, and cancel tasks.
Expand Down Expand Up @@ -190,7 +194,9 @@ Running this code, you will either get output similar to this::
T-minus 7
Result: 1554

or you will get this if the ``kid()`` took too long::
or you will get this if the ``kid()`` took too long:

.. code-block:: console

Getting around to doing my homework
T-minus 10
Expand Down Expand Up @@ -305,7 +311,9 @@ An Echo Server
--------------

A common use of Curio is network programming. Here is an
echo server::
echo server:

.. code-block:: python3

from curio import run, tcp_server

Expand All @@ -322,7 +330,9 @@ echo server::
run(tcp_server, '', 25000, echo_client)

Run this program and connect to it using ``nc`` or ``telnet``. You'll
see the program echoing back data to you::
see the program echoing back data to you:

.. code-block:: console

bash % nc localhost 25000
Hello (you type)
Expand Down