Skip to content

Commit b6f0143

Browse files
author
kuyan
committed
Use the :pep: tag instead of directly linking PEPs
1 parent cbcbce5 commit b6f0143

File tree

10 files changed

+25
-30
lines changed

10 files changed

+25
-30
lines changed

docs/dev/env.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ Vim is a text editor which uses keyboard shortcuts for editing instead of menus
1616
or icons. There exist a couple of plugins and settings for the VIM editor to
1717
aid Python development. If you only develop in Python, a good start is to set
1818
the default settings for indentation and line-wrapping to values compliant with
19-
`PEP 8 <http://www.python.org/dev/peps/pep-0008/>`_. In your home directory,
20-
open a file called `.vimrc` and add the following lines:::
19+
:pep:`8`. In your home directory, open a file called `.vimrc` and add the
20+
following lines:::
2121

2222
set textwidth=79 " lines longer than 79 columns will be broken
2323
set shiftwidth=4 " operation >> indents 4 columns; << unindents 4 columns

docs/intro/community.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ PEPs
2727
PEPs are *Python Enhancement Proposals*. They describe changes to Python itself,
2828
or the standards around it.
2929

30-
There are three different types of PEPs (as defined by `PEP1 <http://www.python.org/dev/peps/pep-0001/>`_):
30+
There are three different types of PEPs (as defined by :pep:`1`):
3131

3232
**Standards**
3333
Describes a new feature or implementation.
@@ -45,13 +45,13 @@ Notable PEPs
4545

4646
There are a few PEPs that could be considered required reading:
4747

48-
- `PEP8 <http://www.python.org/dev/peps/pep-0008/>`_: The Python Style Guide.
48+
- :pep:`8`: The Python Style Guide.
4949
Read this. All of it. Follow it.
5050

51-
- `PEP20 <http://www.python.org/dev/peps/pep-0020/>`_: The Zen of Python.
51+
- :pep:`20`: The Zen of Python.
5252
A list of 19 statements that briefly explain the philosophy behind Python.
5353

54-
- `PEP257 <http://www.python.org/dev/peps/pep-0257/>`_: Docstring Conventions.
54+
- :pep:`257`: Docstring Conventions.
5555
Gives guidelines for semantics and conventions associated with Python
5656
docstrings.
5757

docs/intro/learning.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ Python Koans
6565

6666
Python Koans is a port of Edgecase's Ruby Koans. It uses a test-driven
6767
approach, q.v. TEST DRIVEN DESIGN SECTION to provide an interactive tutorial
68-
teaching basic python concepts. By fixing assertion statements that fail in a
68+
teaching basic python concepts. By fixing assertion statements that fail in a
6969
test script, this provides sequential steps to learning python.
7070

7171
For those used to languages and figuring out puzzles on their own, this can be
@@ -105,7 +105,7 @@ is focused on the more advanced crowd.
105105

106106
It starts with topics like decorators (with caching, proxy, and context manager
107107
case-studies), method resolution order, using super() and meta-programming, and
108-
general PEP8 best practices.
108+
general :pep:`8` best practices.
109109

110110
It has a detailed, multi-chapter case study on writing and releasing a package
111111
and eventually an application, including a chapter on using zc.buildout. Later

docs/scenarios/db.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ DB-API
55
------
66

77
The Python Database API (DB-API) defines a standard interface for Python
8-
database access modules. It's documented in `PEP 249 <http://www.python.org/dev/peps/pep-0249/>`_.
8+
database access modules. It's documented in :pep:`249`.
99
Nearly all Python database modules such as `sqlite3`, `psycopg` and
1010
`mysql-python` conform to this interface.
1111

docs/scenarios/imaging.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ The `Python Imaging Library <http://www.pythonware.com/products/pil/>`_, or PIL
1212
for short, is *the* library for image manipulation in Python. Unfortunately, its
1313
development has stagnated, with its last release in 2009.
1414

15-
Lucky for you, there's an actively-developed fork of PIL called `Pillow <http://python-imaging.github.io/>`_ -
15+
Luckily for you, there's an actively-developed fork of PIL called `Pillow <http://python-imaging.github.io/>`_ -
1616
it's easier to install, runs on all operating systems, and supports Python 3.
1717

1818
Installation

docs/scenarios/web.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ interface between web servers and Python web application frameworks. By
1818
standardizing behavior and communication between web servers and Python web
1919
frameworks, WSGI makes it possible to write portable Python web code that
2020
can be deployed in any :ref:`WSGI-compliant web server <wsgi-servers-ref>`.
21-
WSGI is documented in `PEP-3333 <http://www.python.org/dev/peps/pep-3333/>`_.
21+
WSGI is documented in :pep:`3333`.
2222

2323

2424
Frameworks

docs/writing/documentation.rst

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -104,9 +104,7 @@ In Python, *docstrings* describe modules, classes, and functions: ::
104104
"""Returns the square root of self times self."""
105105
...
106106

107-
In general, follow the `comment section of PEP 0008`_ (the "Python Style Guide").
108-
109-
.. _comment section of PEP 0008: http://www.python.org/dev/peps/pep-0008/#comments
107+
In general, follow the comment section of :pep:`8#comments` (the "Python Style Guide").
110108

111109
Commenting Sections of Code
112110
~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -137,9 +135,7 @@ operation of the function or class: ::
137135
"""Returns the square root of self times self."""
138136
...
139137

140-
.. seealso:: Further reading on docstrings: `PEP 0257`_
141-
142-
.. _PEP 0257: http://www.python.org/dev/peps/pep-0257/
138+
.. seealso:: Further reading on docstrings: :pep:`257`
143139

144140

145141
Other Tools

docs/writing/structure.rst

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -466,9 +466,8 @@ should be your preferred method.
466466
.. note::
467467
You can also use the **%** formatting operator to concatenate the
468468
pre-determined number of strings besides **join()** and **+**. However,
469-
according to `PEP 3101 <http://www.python.org/dev/peps/pep-3101/>`_,
470-
**%** operator became deprecated in Python 3.1 and will be replaced by the
471-
**format()** method in the later versions.
469+
according to :pep:`3101`, the **%** operator became deprecated in
470+
Python 3.1 and will be replaced by the **format()** method in the later versions.
472471

473472
.. code-block:: python
474473

docs/writing/style.rst

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,8 @@ follow the syntax that is the closest to the function definition: ``send('Hello'
117117
'World', cc='Cthulhu', bcc='God')``.
118118

119119
As a side note, following `YAGNI <http://en.wikipedia.org/wiki/You_ain't_gonna_need_it>`_
120-
principle, it is often harder to remove an optional argument (and its logic inside the
121-
function) that was added "just in case" and is seemingly never used, than to add a
120+
principle, it is often harder to remove an optional argument (and its logic inside the
121+
function) that was added "just in case" and is seemingly never used, than to add a
122122
new optional argument and its logic when needed.
123123

124124
3. The **arbitrary argument list** is the third way to pass arguments to a
@@ -256,14 +256,14 @@ are a probable indication that such a refactoring is needed.
256256
Idioms
257257
------
258258

259-
A programming idiom, put simply, is a *way* to write code. The notion of programming idioms
259+
A programming idiom, put simply, is a *way* to write code. The notion of programming idioms
260260
is discussed amply at `c2 <http://c2.com/cgi/wiki?ProgrammingIdiom>`_ and at `Stack Overflow <http://stackoverflow.com/questions/302459/what-is-a-programming-idiom>`_.
261261

262-
Idiomatic Python code is often referred to as being *Pythonic*.
262+
Idiomatic Python code is often referred to as being *Pythonic*.
263263

264-
Although there usually is one-- and preferably only one --obvious way to do it;
264+
Although there usually is one-- and preferably only one --obvious way to do it;
265265
*the* way to write idiomatic Python code can be non-obvious to Python beginners. So,
266-
good idioms must be consciously acquired.
266+
good idioms must be consciously acquired.
267267

268268
Some common Python idioms follow:
269269

@@ -362,7 +362,7 @@ For more information see this `StackOverflow <http://stackoverflow.com/questions
362362
Zen of Python
363363
-------------
364364

365-
Also known as PEP 20, the guiding principles for Python's design.
365+
Also known as :pep:`20`, the guiding principles for Python's design.
366366

367367
::
368368

@@ -399,7 +399,7 @@ PEP 8
399399

400400
PEP 8 is the de-facto code style guide for Python.
401401

402-
`PEP 8 <http://www.python.org/dev/peps/pep-0008/>`_
402+
:pep:`8`
403403

404404
Conforming your Python code to PEP 8 is generally a good idea and helps make
405405
code more consistent when working on projects with other developers. There

docs/writing/tests.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Some general rules of testing:
1616
alone, and also within the test suite, regardless of the order they are called.
1717
The implication of this rule is that each test must be loaded with a fresh
1818
dataset and may have to do some cleanup afterwards. This is usually
19-
handled by setUp() and tearDown() methods.
19+
handled by `setUp()` and `tearDown()` methods.
2020

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
@@ -287,7 +287,7 @@ always returns the same result (but only for the duration of the test).
287287
# not where the SearchForm class itself is imported from
288288
@mock.patch('myapp.SearchForm.search', mock_search)
289289
def test_new_watchlist_activities(self):
290-
# get_search_results runs a search and iterates over the result
290+
# get_search_results runs a search and iterates over the result
291291
self.assertEqual(len(myapp.get_search_results(q="fish")), 3)
292292

293293
Mock has many other ways you can configure it and control its behavior.

0 commit comments

Comments
 (0)