mirror of https://github.com/python/cpython
Avoid using the default reST role. Makes Doc/tools/rstlint.py happy.
This commit is contained in:
parent
48e484fdde
commit
941afedd74
|
@ -45,8 +45,8 @@ The modern interface provides:
|
|||
at least length 2 (additional characters are ignored) which specifies the
|
||||
alternative alphabet used instead of the ``+`` and ``/`` characters.
|
||||
|
||||
The decoded string is returned. A `binascii.Error` is raised if *s* is
|
||||
incorrectly padded.
|
||||
The decoded string is returned. A :exc:`binascii.Error` exception is raised
|
||||
if *s* is incorrectly padded.
|
||||
|
||||
If *validate* is ``False`` (the default), non-base64-alphabet characters are
|
||||
discarded prior to the padding check. If *validate* is ``True``,
|
||||
|
|
|
@ -806,17 +806,17 @@ To get interpolation, use :class:`ConfigParser`::
|
|||
cfg = configparser.ConfigParser()
|
||||
cfg.read('example.cfg')
|
||||
|
||||
# Set the optional `raw` argument of get() to True if you wish to disable
|
||||
# Set the optional *raw* argument of get() to True if you wish to disable
|
||||
# interpolation in a single get operation.
|
||||
print(cfg.get('Section1', 'foo', raw=False)) # -> "Python is fun!"
|
||||
print(cfg.get('Section1', 'foo', raw=True)) # -> "%(bar)s is %(baz)s!"
|
||||
|
||||
# The optional `vars` argument is a dict with members that will take
|
||||
# The optional *vars* argument is a dict with members that will take
|
||||
# precedence in interpolation.
|
||||
print(cfg.get('Section1', 'foo', vars={'bar': 'Documentation',
|
||||
'baz': 'evil'}))
|
||||
|
||||
# The optional `fallback` argument can be used to provide a fallback value
|
||||
# The optional *fallback* argument can be used to provide a fallback value
|
||||
print(cfg.get('Section1', 'foo'))
|
||||
# -> "Python is fun!"
|
||||
|
||||
|
|
|
@ -141,11 +141,11 @@ Here is the :class:`Header` class description:
|
|||
Returns an approximation of the :class:`Header` as a string, using an
|
||||
unlimited line length. All pieces are converted to unicode using the
|
||||
specified encoding and joined together appropriately. Any pieces with a
|
||||
charset of `unknown-8bit` are decoded as `ASCII` using the `replace`
|
||||
charset of ``'unknown-8bit'`` are decoded as ASCII using the ``'replace'``
|
||||
error handler.
|
||||
|
||||
.. versionchanged:: 3.2
|
||||
Added handling for the `unknown-8bit` charset.
|
||||
Added handling for the ``'unknown-8bit'`` charset.
|
||||
|
||||
|
||||
.. method:: __eq__(other)
|
||||
|
|
|
@ -575,13 +575,13 @@ properties, will be invoked and :meth:`__getattr__` and :meth:`__getattribute__`
|
|||
may be called.
|
||||
|
||||
For cases where you want passive introspection, like documentation tools, this
|
||||
can be inconvenient. `getattr_static` has the same signature as :func:`getattr`
|
||||
can be inconvenient. :func:`getattr_static` has the same signature as :func:`getattr`
|
||||
but avoids executing code when it fetches attributes.
|
||||
|
||||
.. function:: getattr_static(obj, attr, default=None)
|
||||
|
||||
Retrieve attributes without triggering dynamic lookup via the
|
||||
descriptor protocol, `__getattr__` or `__getattribute__`.
|
||||
descriptor protocol, :meth:`__getattr__` or :meth:`__getattribute__`.
|
||||
|
||||
Note: this function may not be able to retrieve all attributes
|
||||
that getattr can fetch (like dynamically created attributes)
|
||||
|
@ -589,12 +589,12 @@ but avoids executing code when it fetches attributes.
|
|||
that raise AttributeError). It can also return descriptors objects
|
||||
instead of instance members.
|
||||
|
||||
If the instance `__dict__` is shadowed by another member (for example a
|
||||
If the instance :attr:`__dict__` is shadowed by another member (for example a
|
||||
property) then this function will be unable to find instance members.
|
||||
|
||||
.. versionadded:: 3.2
|
||||
|
||||
`getattr_static` does not resolve descriptors, for example slot descriptors or
|
||||
:func:`getattr_static` does not resolve descriptors, for example slot descriptors or
|
||||
getset descriptors on objects implemented in C. The descriptor object
|
||||
is returned instead of the underlying attribute.
|
||||
|
||||
|
|
|
@ -293,7 +293,7 @@ used from the command line. The basic command-line usage is::
|
|||
|
||||
As a shortcut, ``python -m unittest`` is the equivalent of
|
||||
``python -m unittest discover``. If you want to pass arguments to test
|
||||
discovery the `discover` sub-command must be used explicitly.
|
||||
discovery the ``discover`` sub-command must be used explicitly.
|
||||
|
||||
The ``discover`` sub-command has the following options:
|
||||
|
||||
|
@ -305,11 +305,11 @@ The ``discover`` sub-command has the following options:
|
|||
|
||||
.. cmdoption:: -s directory
|
||||
|
||||
Directory to start discovery ('.' default)
|
||||
Directory to start discovery (``.`` default)
|
||||
|
||||
.. cmdoption:: -p pattern
|
||||
|
||||
Pattern to match test files ('test*.py' default)
|
||||
Pattern to match test files (``test*.py`` default)
|
||||
|
||||
.. cmdoption:: -t directory
|
||||
|
||||
|
@ -724,8 +724,8 @@ Test cases
|
|||
single test.
|
||||
|
||||
.. versionchanged::
|
||||
`TestCase` can be instantiated successfully without providing a method
|
||||
name. This makes it easier to experiment with `TestCase` from the
|
||||
:class:`TestCase` can be instantiated successfully without providing a method
|
||||
name. This makes it easier to experiment with :class:`TestCase` from the
|
||||
interactive interpreter.
|
||||
|
||||
*methodName* defaults to :meth:`runTest`.
|
||||
|
@ -940,17 +940,17 @@ Test cases
|
|||
+---------------------------------------------------------+--------------------------------------+------------+
|
||||
| Method | Checks that | New in |
|
||||
+=========================================================+======================================+============+
|
||||
| :meth:`assertRaises(exc, fun, *args, **kwds) | ``fun(*args, **kwds)`` raises `exc` | |
|
||||
| :meth:`assertRaises(exc, fun, *args, **kwds) | ``fun(*args, **kwds)`` raises *exc* | |
|
||||
| <TestCase.assertRaises>` | | |
|
||||
+---------------------------------------------------------+--------------------------------------+------------+
|
||||
| :meth:`assertRaisesRegex(exc, re, fun, *args, **kwds) | ``fun(*args, **kwds)`` raises `exc` | 3.1 |
|
||||
| <TestCase.assertRaisesRegex>` | and the message matches `re` | |
|
||||
| :meth:`assertRaisesRegex(exc, re, fun, *args, **kwds) | ``fun(*args, **kwds)`` raises *exc* | 3.1 |
|
||||
| <TestCase.assertRaisesRegex>` | and the message matches *re* | |
|
||||
+---------------------------------------------------------+--------------------------------------+------------+
|
||||
| :meth:`assertWarns(warn, fun, *args, **kwds) | ``fun(*args, **kwds)`` raises `warn` | 3.2 |
|
||||
| :meth:`assertWarns(warn, fun, *args, **kwds) | ``fun(*args, **kwds)`` raises *warn* | 3.2 |
|
||||
| <TestCase.assertWarns>` | | |
|
||||
+---------------------------------------------------------+--------------------------------------+------------+
|
||||
| :meth:`assertWarnsRegex(warn, re, fun, *args, **kwds) | ``fun(*args, **kwds)`` raises `warn` | 3.2 |
|
||||
| <TestCase.assertWarnsRegex>` | and the message matches `re` | |
|
||||
| :meth:`assertWarnsRegex(warn, re, fun, *args, **kwds) | ``fun(*args, **kwds)`` raises *warn* | 3.2 |
|
||||
| <TestCase.assertWarnsRegex>` | and the message matches *re* | |
|
||||
+---------------------------------------------------------+--------------------------------------+------------+
|
||||
|
||||
.. method:: assertRaises(exception, callable, *args, **kwds)
|
||||
|
@ -1092,7 +1092,7 @@ Test cases
|
|||
| :meth:`assertNotRegex(s, re) | ``not regex.search(s)`` | 3.2 |
|
||||
| <TestCase.assertNotRegex>` | | |
|
||||
+---------------------------------------+--------------------------------+--------------+
|
||||
| :meth:`assertCountEqual(a, b) | `a` and `b` have the same | 3.2 |
|
||||
| :meth:`assertCountEqual(a, b) | *a* and *b* have the same | 3.2 |
|
||||
| <TestCase.assertCountEqual>` | elements in the same number, | |
|
||||
| | regardless of their order | |
|
||||
+---------------------------------------+--------------------------------+--------------+
|
||||
|
@ -1887,7 +1887,7 @@ Loading and running tests
|
|||
.. class:: TextTestRunner(stream=None, descriptions=True, verbosity=1, runnerclass=None, warnings=None)
|
||||
|
||||
A basic test runner implementation that outputs results to a stream. If *stream*
|
||||
is `None`, the default, `sys.stderr` is used as the output stream. This class
|
||||
is ``None``, the default, :data:`sys.stderr` is used as the output stream. This class
|
||||
has a few configurable parameters, but is essentially very simple. Graphical
|
||||
applications which run test suites should provide alternate implementations.
|
||||
|
||||
|
@ -1904,7 +1904,7 @@ Loading and running tests
|
|||
Added the ``warnings`` argument.
|
||||
|
||||
.. versionchanged:: 3.2
|
||||
The default stream is set to `sys.stderr` at instantiation time rather
|
||||
The default stream is set to :data:`sys.stderr` at instantiation time rather
|
||||
than import time.
|
||||
|
||||
.. method:: _makeResult()
|
||||
|
|
Loading…
Reference in New Issue