Issue #26462: Doc: reduce literal_block warnings, fix syntax highlighting.

Patch by Julien Palard.
This commit is contained in:
Martin Panter 2016-07-26 11:18:21 +02:00
parent 87ec85f420
commit 1050d2d0c7
47 changed files with 329 additions and 128 deletions

View file

@ -152,7 +152,9 @@ Let's dive in!
For my example I'm using ``_pickle.Pickler.dump()``.
2. If the call to the ``PyArg_Parse`` function uses any of the
following format units::
following format units:
.. code-block:: none
O&
O!

View file

@ -377,7 +377,9 @@ An example of using these two classes follows (imports omitted)::
root.warning('Look out!')
listener.stop()
which, when run, will produce::
which, when run, will produce:
.. code-block:: none
MainThread: Look out!
@ -1860,7 +1862,9 @@ script, ``chowntest.py``::
logger = logging.getLogger('mylogger')
logger.debug('A debug message')
To run this, you will probably need to run as ``root``::
To run this, you will probably need to run as ``root``:
.. code-block:: shell-session
$ sudo python3.3 chowntest.py
$ cat chowntest.log
@ -2485,7 +2489,9 @@ via ``stderr`` and once via ``stdout``). After the ``with`` statement's
completion, the status is as it was before so message #6 appears (like message
#1) whereas message #7 doesn't (just like message #2).
If we run the resulting script, the result is as follows::
If we run the resulting script, the result is as follows:
.. code-block:: shell-session
$ python logctx.py
1. This should appear just once on stderr.
@ -2495,12 +2501,16 @@ If we run the resulting script, the result is as follows::
6. This should appear just once on stderr.
If we run it again, but pipe ``stderr`` to ``/dev/null``, we see the following,
which is the only message written to ``stdout``::
which is the only message written to ``stdout``:
.. code-block:: shell-session
$ python logctx.py 2>/dev/null
5. This should appear twice - once on stderr and once on stdout.
Once again, but piping ``stdout`` to ``/dev/null``, we get::
Once again, but piping ``stdout`` to ``/dev/null``, we get:
.. code-block:: shell-session
$ python logctx.py >/dev/null
1. This should appear just once on stderr.

View file

@ -106,7 +106,9 @@ A very simple example is::
logging.warning('Watch out!') # will print a message to the console
logging.info('I told you so') # will not print anything
If you type these lines into a script and run it, you'll see::
If you type these lines into a script and run it, you'll see:
.. code-block:: none
WARNING:root:Watch out!
@ -230,7 +232,9 @@ append the variable data as arguments. For example::
import logging
logging.warning('%s before you %s', 'Look', 'leap!')
will display::
will display:
.. code-block:: none
WARNING:root:Look before you leap!
@ -594,7 +598,9 @@ logger, a console handler, and a simple formatter using Python code::
logger.error('error message')
logger.critical('critical message')
Running this module from the command line produces the following output::
Running this module from the command line produces the following output:
.. code-block:: shell-session
$ python simple_logging_module.py
2005-03-19 15:10:26,618 - simple_example - DEBUG - debug message
@ -653,7 +659,9 @@ Here is the logging.conf file::
format=%(asctime)s - %(name)s - %(levelname)s - %(message)s
datefmt=
The output is nearly identical to that of the non-config-file-based example::
The output is nearly identical to that of the non-config-file-based example:
.. code-block:: shell-session
$ python simple_logging_config.py
2005-03-19 15:38:55,977 - simpleExample - DEBUG - debug message
@ -1073,4 +1081,3 @@ take up any memory.
Useful handlers included with the logging module.
:ref:`A logging cookbook <logging-cookbook>`

View file

@ -74,7 +74,9 @@ of the RE by repeating them or changing their meaning. Much of this document is
devoted to discussing various metacharacters and what they do.
Here's a complete list of the metacharacters; their meanings will be discussed
in the rest of this HOWTO. ::
in the rest of this HOWTO.
.. code-block:: none
. ^ $ * + ? { } [ ] \ | ( )

View file

@ -613,7 +613,9 @@ program::
print(os.listdir(b'.'))
print(os.listdir('.'))
will produce the following output::
will produce the following output:
.. code-block:: shell-session
amk:~$ python t.py
[b'filename\xe4\x94\x80abc', ...]