Skip to content

Commit 70ca1a8

Browse files
committed
lines less than 80 chars in /writing/
1 parent 6978c5a commit 70ca1a8

File tree

4 files changed

+55
-41
lines changed

4 files changed

+55
-41
lines changed

docs/writing/documentation.rst

+9-3
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ Docstrings
3838

3939
PEP 257 is the primary reference for docstrings. (http://www.python.org/dev/peps/pep-0257/)
4040

41-
There are two types of docstrings, one-line and multi-line. Their names should be fairly self explanatory.
41+
There are two types of docstrings, one-line and multi-line. Their names
42+
should be fairly self explanatory.
4243
One-line docstrings: ::
4344

4445
def kos_root():
@@ -63,7 +64,9 @@ Multi-line docstrings: ::
6364
Sphinx
6465
------
6566

66-
Sphinx_ is a tool which converts documentation in the :ref:`restructuredtext-ref` markup language into a range of output formats including HTML, LaTeX (for printable PDF versions), manual pages and plain text.
67+
Sphinx_ is a tool which converts documentation in the :ref:`restructuredtext-ref`
68+
markup language into a range of output formats including HTML, LaTeX (for
69+
printable PDF versions), manual pages and plain text.
6770

6871
.. note:: This Guide is built with Sphinx_
6972

@@ -75,7 +78,10 @@ Sphinx_ is a tool which converts documentation in the :ref:`restructuredtext-ref
7578
reStructuredText
7679
----------------
7780

78-
Most Python documentation is written with reStructuredText_. The `reStructuredText Primer <http://sphinx.pocoo.org/rest.html>`_ and the `reStructuredText Quick Reference <http://docutils.sourceforge.net/docs/user/rst/quickref.html>`_ should help you familiarize yourself with its syntax.
81+
Most Python documentation is written with reStructuredText_. The
82+
`reStructuredText Primer <http://sphinx.pocoo.org/rest.html>`_ and the
83+
`reStructuredText Quick Reference <http://docutils.sourceforge.net/docs/user/rst/quickref.html>`_
84+
should help you familiarize yourself with its syntax.
7985

8086
.. _reStructuredText: http://docutils.sourceforge.net/rst.html
8187

docs/writing/license.rst

+4-2
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,11 @@ Choosing a License
33

44
Open source.
55

6-
There are plenty of `open source licenses <http://opensource.org/licenses/alphabetical>`_ available to choose from.
6+
There are plenty of `open source licenses <http://opensource.org/licenses/alphabetical>`_
7+
available to choose from.
78

8-
To help you choose one for your project, there's a `license chooser <http://three.org/openart/license_chooser/>`_, use it.
9+
To help you choose one for your project, there's a `license chooser <http://three.org/openart/license_chooser/>`_,
10+
use it.
911

1012

1113
Non-Restrictive

docs/writing/style.rst

+17-13
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,8 @@ keep a count of your place in the list.
261261
# 1, 4
262262
# 2, 5
263263
264-
The ``enumerate`` function has better readability than handling a counter manually. Moreover,
264+
The ``enumerate`` function has better readability than handling a counter
265+
manually. Moreover,
265266
it is better optimized for iterators.
266267

267268
Read From a File
@@ -287,8 +288,8 @@ files for you.
287288
for line in f:
288289
print line
289290
290-
The ``with`` statement is better because it will ensure you always close the file,
291-
even if an exception is raised.
291+
The ``with`` statement is better because it will ensure you always close the
292+
file, even if an exception is raised.
292293

293294
Returning Multiple Values from a Function
294295
-----------------------------------------
@@ -320,15 +321,17 @@ values in before you return
320321
Line Continuations
321322
~~~~~~~~~~~~~~~~~~
322323

323-
When a logical line of code is longer than the accepted limit, you need to split it over multiple
324-
physical lines. Python interpreter will join consecutive lines if the last character of the line is
325-
a backslash. This is helpful sometime but is preferably avoided, because of its fragility: a white
326-
space added to the end of the line, after the backslash, will break the code and may have unexpected
327-
results.
324+
When a logical line of code is longer than the accepted limit, you need to
325+
split it over multiple physical lines. Python interpreter will join consecutive
326+
lines if the last character of the line is a backslash. This is helpful
327+
sometime but is preferably avoided, because of its fragility: a white space
328+
added to the end of the line, after the backslash, will break the code and may
329+
have unexpected results.
328330

329-
A prefered solution is to use parenthesis around your elements. Left with an unclosed parenthesis on an end-of-line
330-
the Python interpreter will join the next line until the parenthesis is closed. The same behavior holds for
331-
curly and square braces.
331+
A prefered solution is to use parenthesis around your elements. Left with an
332+
unclosed parenthesis on an end-of-line the Python interpreter will join the
333+
next line until the parenthesis is closed. The same behavior holds for curly
334+
and square braces.
332335

333336
**Bad**:
334337

@@ -352,5 +355,6 @@ curly and square braces.
352355
from some.deep.module.inside.a.module import (a_nice_function, another_nice_function,
353356
yet_another_nice_functio)
354357
355-
However, more often than not having to split long logical line is a sign that you
356-
are trying to do too many things at the same time, which may hinder readability.
358+
However, more often than not having to split long logical line is a sign that
359+
you are trying to do too many things at the same time, which may hinder
360+
readability.

docs/writing/tests.rst

+25-23
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,10 @@ Some general rules of testing:
2121
- Try hard to make tests that run fast. If one single test needs more than a
2222
few millisecond to run, development will be slowed down or the tests will not
2323
be run as often as desirable. In some cases, test can't be fast because they
24-
need a complex data structure to work on, and this data structure must be loaded
25-
every time the test runs. Keep these heavier tests in a separate test suite
26-
that is run by some scheduled task, and run all other tests as often as needed.
24+
need a complex data structure to work on, and this data structure must be
25+
loaded every time the test runs. Keep these heavier tests in a separate test
26+
suite that is run by some scheduled task, and run all other tests as often
27+
as needed.
2728

2829
- Learn your tools and learn how to run a single test or a test case. Then,
2930
when developing a function inside a module, run this function's tests very
@@ -41,9 +42,9 @@ Some general rules of testing:
4142
When comming back to work, you will have a pointer to where you were and get
4243
faster on tracks.
4344

44-
- The first step when you are debugging your code is to write a new test pinpointing
45-
the bug. While it is not always possible to do, those bug catching test are among
46-
the most valuable piece of code in your project.
45+
- The first step when you are debugging your code is to write a new test
46+
pinpointing the bug. While it is not always possible to do, those bug
47+
catching test are among the most valuable piece of code in your project.
4748

4849
- Use long and descriptive names for testing functions. The style guide here is
4950
slighlty different than that of running code, where short names are often
@@ -62,10 +63,10 @@ Some general rules of testing:
6263
- Another use of the testing code is as an introduction to new developers. When
6364
someone will have to work on the code base, runnning and reading the related
6465
testing code is often the best they can do. They will or should discover the
65-
hot spots, where most difficulties arise, and the corner cases. If they have to
66-
add some functionality, the first step should be to add a test and, by this mean,
67-
ensure the new functionality is not already a working path that has not been
68-
plugged in the interface.
66+
hot spots, where most difficulties arise, and the corner cases. If they have
67+
to add some functionality, the first step should be to add a test and, by this
68+
mean, ensure the new functionality is not already a working path that has not
69+
been plugged in the interface.
6970

7071
The Basics
7172
::::::::::
@@ -99,15 +100,15 @@ As of Python 2.7 unittest also includes its own test discovery mechanisms.
99100
Doctest
100101
-------
101102

102-
The doctest module searches for pieces of text that look like interactive Python
103-
sessions in docstrings, and then executes those sessions to verify that they work exactly as
104-
shown.
103+
The doctest module searches for pieces of text that look like interactive
104+
Python sessions in docstrings, and then executes those sessions to verify that
105+
they work exactly as shown.
105106

106-
Doctests have a different use case than proper unit tests: they are usually less
107-
detailed and don't catch special cases or obscure regression bugs. They are
108-
useful as an expressive documentation of the main use cases of a module and
109-
its components. However, doctests should run automatically each time
110-
the full test suite runs.
107+
Doctests have a different use case than proper unit tests: they are usually
108+
less detailed and don't catch special cases or obscure regression bugs. They
109+
are useful as an expressive documentation of the main use cases of a module and
110+
its components. However, doctests should run automatically each time the full
111+
test suite runs.
111112

112113
A simple doctest in a function:
113114

@@ -128,8 +129,9 @@ A simple doctest in a function:
128129
import doctest
129130
doctest.testmod()
130131

131-
When running this module from the command line as in ``python module.py``, the doctests
132-
will run and complain if anything is not behaving as described in the docstrings.
132+
When running this module from the command line as in ``python module.py``, the
133+
doctests will run and complain if anything is not behaving as described in the
134+
docstrings.
133135

134136
Tools
135137
:::::
@@ -144,7 +146,7 @@ py.test is a no-boilerplate alternative to Python's standard unittest module.
144146

145147
$ pip install pytest
146148

147-
Despite being a fully-featured and extensible test tool it boasts a simple
149+
Despite being a fully-featured and extensible test tool it boasts a simple
148150
syntax. Creating a test suite is as easy as writing a module with a couple of
149151
functions
150152

@@ -205,8 +207,8 @@ xUnit-compatible test output, coverage reporting, and test selection.
205207
tox
206208
---
207209

208-
tox is a tool for automating test environment management and testing against multiple
209-
interpreter configurations
210+
tox is a tool for automating test environment management and testing against
211+
multiple interpreter configurations
210212

211213
::
212214

0 commit comments

Comments
 (0)