Skip to content
This repository was archived by the owner on May 31, 2021. It is now read-only.

Commit 4971c29

Browse files
mentaalludovic-gasc
authored andcommitted
Reformatted files to 80 characters per line (#5)
Using InterSphinx to make links to methods work small change to clarify hello_clock
1 parent b00bdce commit 4971c29

7 files changed

+76
-26
lines changed

Diff for: README.rst

+2-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ Ideas
1919
* Advanced section:
2020

2121
- protocols and transports: as least point to good implementations
22-
- explain how to *test* asyncio applications. `Twisted documentation example <https://twistedmatrix.com/documents/current/core/howto/trial.html>`_
22+
- explain how to *test* asyncio applications. `Twisted documentation example
23+
<https://twistedmatrix.com/documents/current/core/howto/trial.html>`_
2324

2425
How to install Sphinx
2526
=====================

Diff for: conf.py

+21-4
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@
1616
# add these directories to sys.path here. If the directory is relative to the
1717
# documentation root, use os.path.abspath to make it absolute, like shown here.
1818
#
19-
# import os
20-
# import sys
21-
# sys.path.insert(0, os.path.abspath('.'))
19+
import os
20+
import sys
21+
sys.path.insert(0, os.path.abspath('.'))
2222

2323
# -- General configuration ------------------------------------------------
2424

@@ -29,7 +29,7 @@
2929
# Add any Sphinx extension module names here, as strings. They can be
3030
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
3131
# ones.
32-
extensions = []
32+
#extensions = ['alabaster']
3333

3434
# Add any paths that contain templates here, relative to this directory.
3535
templates_path = ['_templates']
@@ -119,8 +119,25 @@
119119
# The theme to use for HTML and HTML Help pages. See the documentation for
120120
# a list of builtin themes.
121121
#
122+
import alabaster
122123
html_theme = 'alabaster'
123124

125+
html_theme_path = [alabaster.get_path()]
126+
extensions = ['alabaster', 'sphinx.ext.intersphinx']
127+
html_theme = 'alabaster'
128+
html_sidebars = {
129+
'**': [
130+
'about.html',
131+
'navigation.html',
132+
'relations.html',
133+
'searchbox.html',
134+
'donate.html',
135+
'localtoc.html',
136+
'sourcelink.html',
137+
]
138+
}
139+
intersphinx_mapping = {'python': ('https://docs.python.org/3.5', None)}
140+
124141
# Theme options are theme-specific and customize the look and feel of a theme
125142
# further. For a list of options available for each theme, see the
126143
# documentation.

Diff for: getting_started.rst

+10-5
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,21 @@ Getting Started
55
Get Python 3.5
66
==============
77

8-
Sorry but this documentation is written for Python 3.5 to avail of the new ``async``
8+
Sorry but this documentation is written for Python 3.5 to avail of the new
9+
``async``
910
and ``await`` keywords.
1011

1112
.. would be good to have some word about installing on Windows
12-
* Windows: the easiest way to use Python 3.5 would be to use a package manager like Conda
13-
There are instructions for using a python 3.5 environment in `Conda here <http://conda.pydata.org/docs/py2or3.html#create-a-python-3-5-environment>`_.
13+
* Windows: the easiest way to use Python 3.5 would be to use a package manager
14+
like Conda
15+
There are instructions for using a python 3.5 environment in `Conda here
16+
<http://conda.pydata.org/docs/py2or3.html#create-a-python-3-5-environment>`_.
1417
* Mac OS X: install `Homebrew </usr/bin/ruby -e "$(curl -fsSL
1518
https://raw.githubusercontent.com/Homebrew/install/master/install)">`_ and
1619
then type ``brew install python3``
1720
* Linux: Ubuntu 16.04+ and Arch linux ship with Python 3.5 included.
18-
If you don't have Python 3.5+ on your computer, you can compile it or use `Pythonz <https://github.com/saghul/pythonz>`_
21+
If you don't have Python 3.5+ on your computer, you can compile it or use
22+
`Pythonz <https://github.com/saghul/pythonz>`_
1923

2024

2125
Create a virtual environment to run examples
@@ -26,7 +30,8 @@ Create a virtual environment::
2630
python3 -m venv venv
2731

2832
.. note::
29-
Depending on your platform, the python 3 interpreter could be invoked by ``python`` instead. This is the case for Conda on Windows for example.
33+
Depending on your platform, the python 3 interpreter could be invoked by
34+
``python`` instead. This is the case for Conda on Windows for example.
3035

3136
Install aiohttp in the virtual environment::
3237

Diff for: glossary.rst

+13-4
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,22 @@ Glossary
99
.. glossary::
1010

1111
coroutine
12-
A coroutine is a piece of code that can be paused and resumed. In contrast to threads which are preemptively multitasked by the operating system, coroutines multitask cooperatively. I.e. they choose when to pause (or to use terminology for coroutines before 3.4 - ``yield``) execution. They can also execute other coroutines.
12+
A coroutine is a piece of code that can be paused and resumed. In
13+
contrast to threads which are preemptively multitasked by the operating
14+
system, coroutines multitask cooperatively. I.e. they choose when to
15+
pause (or to use terminology for coroutines before 3.4 - ``yield``)
16+
execution. They can also execute other coroutines.
1317

1418
event loop
15-
The event loop is the central execution device to launch execution of coroutines and handle I/O (Network, sub-processes...)
19+
The event loop is the central execution device to launch execution of
20+
coroutines and handle I/O (Network, sub-processes...)
1621

1722
future
18-
It's like a mailbox where you can subscribe to receive a result when it will be done. More details in `official documentation <https://docs.python.org/3/library/asyncio-task.html#future>`_
23+
It's like a mailbox where you can subscribe to receive a result when it
24+
will be done. More details in `official documentation
25+
<https://docs.python.org/3/library/asyncio-task.html#future>`_
1926

2027
task
21-
It represents the execution of a coroutine and take care the result in a future. More details in `official documentation <https://docs.python.org/3/library/asyncio-task.html#task>`_
28+
It represents the execution of a coroutine and take care the result in a
29+
future. More details in `official documentation
30+
<https://docs.python.org/3/library/asyncio-task.html#task>`_

Diff for: hello_clock.rst

+6-4
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
Hello Clock
22
^^^^^^^^^^^
33

4-
Example illustrating how to schedule two :term:`coroutines <coroutine>` to run concurrently.
5-
They run for ten minutes, during which the first :term:`coroutine <coroutine>` is scheduled every
6-
second, while the second is scheduled every minute.
4+
Example illustrating how to schedule two :term:`coroutines <coroutine>` to run
5+
concurrently. They run for ten minutes, during which the first :term:`coroutine
6+
<coroutine>` is scheduled to run every second, while the second is scheduled to
7+
run every minute.
78

8-
The function `asyncio.gather` is used to schedule both :term:`coroutines <coroutine>` at once.
9+
The function `asyncio.gather` is used to schedule both :term:`coroutines
10+
<coroutine>` at once.
911

1012
.. literalinclude:: examples/hello_clock.py

Diff for: hello_world.rst

+16-8
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,19 @@
22
Hello World
33
+++++++++++
44

5-
This is a series of examples showing the basics of how write :term:`coroutines <coroutine>` and
5+
This is a series of examples showing the basics of how write :term:`coroutines
6+
<coroutine>` and
67
schedule them in the asyncio :term:`event loop <event loop>`.
78

89
Simple coroutine
910
----------------
1011

11-
Example using the :meth:`BaseEventLoop.run_until_complete` method to schedule a
12+
Example using the :py:meth:`asyncio.BaseEventLoop.run_until_complete` method to
13+
schedule a
1214
simple function that will wait one second, print 'hello' and then finish.
1315

14-
Because it is launched with `run_until_complete`, the :term:`event loop <event loop>` itself
16+
Because it is launched with `run_until_complete`, the :term:`event loop <event
17+
loop>` itself
1518
will terminate once the :term:`coroutine <coroutine>` is completed.
1619

1720
.. literalinclude:: examples/hello_world.py
@@ -20,13 +23,16 @@ will terminate once the :term:`coroutine <coroutine>` is completed.
2023
Creating tasks
2124
--------------
2225

23-
This second example show how you can schedule multiple :term:`coroutines <coroutine>` in the
26+
This second example show how you can schedule multiple :term:`coroutines
27+
<coroutine>` in the
2428
event loop, and then run the :term:`event loop <event loop>`.
2529

2630
Notice that this example will print 'second_hello' before 'first_hello',
27-
as the first :term:`task <task>` scheduled waits longer that the second one before printing.
31+
as the first :term:`task <task>` scheduled waits longer that the second one
32+
before printing.
2833

29-
Also note that this example will never terminate, as the :term:`loop <event loop>` is asked to
34+
Also note that this example will never terminate, as the :term:`loop <event
35+
loop>` is asked to
3036
`run_forever`.
3137

3238
.. literalinclude:: examples/create_task.py
@@ -35,13 +41,15 @@ Also note that this example will never terminate, as the :term:`loop <event loo
3541
Stopping the loop
3642
-----------------
3743

38-
This third example adds another :term:`task <task>` that will stop the :term:`event loop <event loop>` before
44+
This third example adds another :term:`task <task>` that will stop the
45+
:term:`event loop <event loop>` before
3946
all scheduled :term:`tasks <task>` could execute, which results in a warning.
4047

4148
.. literalinclude:: examples/loop_stop.py
4249

4350
Warning::
4451

4552
Task was destroyed but it is pending!
46-
task: <Task pending coro=<say() done, defined at examples/loop_stop.py:3> wait_for=<Future pending cb=[Task._wakeup()]>>
53+
task: <Task pending coro=<say() done, defined at examples/loop_stop.py:3>
54+
wait_for=<Future pending cb=[Task._wakeup()]>>
4755

Diff for: index.rst

+8
Original file line numberDiff line numberDiff line change
@@ -51,3 +51,11 @@ See also
5151
* `Writing Redis in Python with asyncio: Part 1
5252
<http://jamesls.com/writing-redis-in-python-with-asyncio-part-1.html>`_
5353
by James Saryerwinnie
54+
55+
Contributing
56+
============
57+
58+
.. toctree::
59+
:maxdepth: 2
60+
61+
README.rst

0 commit comments

Comments
 (0)