@@ -307,8 +307,8 @@ The :mod:`threading` module's locks and condition variables also support the
307307The lock is acquired before the block is executed and always released once the
308308block is complete.
309309
310- The :func: `decimal.localcontext ` function in the :mod: `decimal ` module makes
311- it easy to save and restore the current decimal context, which encapsulates
310+ The :func: `decimal.localcontext ` function in the :mod: `decimal ` module makes
311+ it easy to save and restore the current decimal context, which encapsulates
312312the desired precision and rounding characteristics for computations::
313313
314314 from decimal import Decimal, Context, localcontext
@@ -337,11 +337,11 @@ underlying implementation and should keep reading.
337337A high-level explanation of the context management protocol is:
338338
339339* The expression is evaluated and should result in an object called a "context
340- manager". The context manager must have :meth: `~object.__enter__ ` and
340+ manager". The context manager must have :meth: `~object.__enter__ ` and
341341 :meth: `~object.__exit__ ` methods.
342342
343- * The context manager's :meth: `~object.__enter__ ` method is called. The value
344- returned is assigned to *VAR *. If no ``as VAR `` clause is present, the
343+ * The context manager's :meth: `~object.__enter__ ` method is called. The value
344+ returned is assigned to *VAR *. If no ``as VAR `` clause is present, the
345345 value is simply discarded.
346346
347347* The code in *BLOCK * is executed.
@@ -431,14 +431,14 @@ The contextlib module
431431The :mod: `contextlib ` module provides some functions and a decorator that
432432are useful when writing objects for use with the ':keyword: `with `' statement.
433433
434- The decorator is called :func: `~contextlib.contextmanager `, and lets you write
435- a single generator function instead of defining a new class. The generator
436- should yield exactly one value. The code up to the :keyword: `yield ` will be
437- executed as the :meth: `~object.__enter__ ` method, and the value yielded will
438- be the method's return value that will get bound to the variable in the
439- ':keyword: `with `' statement's :keyword: `!as ` clause, if any. The code after
440- the :keyword: `!yield ` will be executed in the :meth: `~object.__exit__ ` method.
441- Any exception raised in the block will be raised by the :keyword: `!yield `
434+ The decorator is called :func: `~contextlib.contextmanager `, and lets you write
435+ a single generator function instead of defining a new class. The generator
436+ should yield exactly one value. The code up to the :keyword: `yield ` will be
437+ executed as the :meth: `~object.__enter__ ` method, and the value yielded will
438+ be the method's return value that will get bound to the variable in the
439+ ':keyword: `with `' statement's :keyword: `!as ` clause, if any. The code after
440+ the :keyword: `!yield ` will be executed in the :meth: `~object.__exit__ ` method.
441+ Any exception raised in the block will be raised by the :keyword: `!yield `
442442statement.
443443
444444Using this decorator, our database example from the previous section
@@ -572,8 +572,8 @@ approach of the module is still similar. The fundamental class
572572is the :class: `~multiprocessing.Process `, which is passed a callable object and
573573a collection of arguments. The :meth: `~multiprocessing.Process.start ` method
574574sets the callable running in a subprocess, after which you can call
575- the :meth: `~multiprocessing.Process.is_alive ` method to check whether the
576- subprocess is still running and the :meth: `~multiprocessing.Process.join `
575+ the :meth: `~multiprocessing.Process.is_alive ` method to check whether the
576+ subprocess is still running and the :meth: `~multiprocessing.Process.join `
577577method to wait for the process to exit.
578578
579579Here's a simple example where the subprocess will calculate a
@@ -621,14 +621,14 @@ the object to communicate. (If the parent were to change the value of
621621the global variable, the child's value would be unaffected, and vice
622622versa.)
623623
624- Two other classes, :class: `~multiprocessing.pool.Pool ` and
625- :class: `~multiprocessing.Manager `, provide higher-level interfaces.
626- :class: `~multiprocessing.pool.Pool ` will create a fixed number of worker
627- processes, and requests can then be distributed to the workers by calling
628- :meth: `~multiprocessing.pool.Pool.apply ` or
629- :meth: `~multiprocessing.pool.Pool.apply_async ` to add a single request, and
624+ Two other classes, :class: `~multiprocessing.pool.Pool ` and
625+ :class: `~multiprocessing.Manager `, provide higher-level interfaces.
626+ :class: `~multiprocessing.pool.Pool ` will create a fixed number of worker
627+ processes, and requests can then be distributed to the workers by calling
628+ :meth: `~multiprocessing.pool.Pool.apply ` or
629+ :meth: `~multiprocessing.pool.Pool.apply_async ` to add a single request, and
630630:meth: `map ` or :meth: `~multiprocessing.pool.Pool.map_async ` to add a number of
631- requests. The following code uses a :class: `~multiprocessing.pool.Pool ` to
631+ requests. The following code uses a :class: `~multiprocessing.pool.Pool ` to
632632spread requests across 5 worker processes and retrieve a list of results::
633633
634634 from multiprocessing import Pool
@@ -650,17 +650,17 @@ This produces the following output::
650650 33452526613163807108170062053440751665152000000000
651651 ...
652652
653- The other high-level interface, the :class: `~multiprocessing.Manager ` class,
653+ The other high-level interface, the :class: `~multiprocessing.Manager ` class,
654654creates a separate server process that can hold master copies of Python data
655655structures. Other processes can then access and modify these data
656656structures using proxy objects. The following example creates a
657657shared dictionary by calling the :meth: `dict ` method; the worker
658658processes then insert values into the dictionary. (Locking is not
659659done for you automatically, which doesn't matter in this example.
660- :class: `~multiprocessing.Manager `'s methods also include
661- :meth: `~multiprocessing.managers.SyncManager.Lock `,
660+ :class: `~multiprocessing.Manager `'s methods also include
661+ :meth: `~multiprocessing.managers.SyncManager.Lock `,
662662:meth: `~multiprocessing.managers.SyncManager.RLock `,
663- and :meth: `~multiprocessing.managers.SyncManager.Semaphore ` to create
663+ and :meth: `~multiprocessing.managers.SyncManager.Semaphore ` to create
664664shared locks.)
665665
666666::
@@ -1036,21 +1036,21 @@ PEP 3116: New I/O Library
10361036
10371037Python's built-in file objects support a number of methods, but
10381038file-like objects don't necessarily support all of them. Objects that
1039- imitate files usually support :meth: `~io.TextIOBase.read ` and
1040- :meth: `~io.TextIOBase.write `, but they may not support :meth: `readline `,
1041- for example. Python 3.0 introduces a layered I/O library in the :mod: `io `
1042- module that separates buffering and text-handling features from the
1039+ imitate files usually support :meth: `~io.TextIOBase.read ` and
1040+ :meth: `~io.TextIOBase.write `, but they may not support :meth: `readline `,
1041+ for example. Python 3.0 introduces a layered I/O library in the :mod: `io `
1042+ module that separates buffering and text-handling features from the
10431043fundamental read and write operations.
10441044
10451045There are three levels of abstract base classes provided by
10461046the :mod: `io ` module:
10471047
10481048* :class: `~io.RawIOBase ` defines raw I/O operations: :meth: `~io.RawIOBase.read `,
1049- :meth: `~io.RawIOBase.readinto `, :meth: `~io.RawIOBase.write `,
1049+ :meth: `~io.RawIOBase.readinto `, :meth: `~io.RawIOBase.write `,
10501050 :meth: `~io.IOBase.seek `, :meth: `~io.IOBase.tell `, :meth: `~io.IOBase.truncate `,
10511051 and :meth: `~io.IOBase.close `.
10521052 Most of the methods of this class will often map to a single system call.
1053- There are also :meth: `~io.IOBase.readable `, :meth: `~io.IOBase.writable `,
1053+ There are also :meth: `~io.IOBase.readable `, :meth: `~io.IOBase.writable `,
10541054 and :meth: `~io.IOBase.seekable ` methods for determining what operations a
10551055 given object will allow.
10561056
@@ -1062,7 +1062,7 @@ the :mod:`io` module:
10621062 buffers data in memory to reduce the number of
10631063 system calls used, making I/O processing more efficient.
10641064 It supports all of the methods of :class: `~io.RawIOBase `,
1065- and adds a :attr: `~io.BufferedIOBase.raw ` attribute holding the underlying
1065+ and adds a :attr: `~io.BufferedIOBase.raw ` attribute holding the underlying
10661066 raw object.
10671067
10681068 There are five concrete classes implementing this ABC.
0 commit comments