Commit 96d5c541 authored by Serhiy Storchaka's avatar Serhiy Storchaka

Issue #18757: Improved cross-references in the concurrent package.

parents 0acbcb5b 9e0ae539
...@@ -40,7 +40,7 @@ Executor Objects ...@@ -40,7 +40,7 @@ Executor Objects
.. method:: map(func, *iterables, timeout=None) .. method:: map(func, *iterables, timeout=None)
Equivalent to ``map(func, *iterables)`` except *func* is executed Equivalent to :func:`map(func, *iterables) <map>` except *func* is executed
asynchronously and several calls to *func* may be made concurrently. The asynchronously and several calls to *func* may be made concurrently. The
returned iterator raises a :exc:`TimeoutError` if returned iterator raises a :exc:`TimeoutError` if
:meth:`~iterator.__next__` is called and the result isn't available :meth:`~iterator.__next__` is called and the result isn't available
......
This diff is collapsed.
...@@ -54,13 +54,15 @@ The :mod:`queue` module defines the following classes and exceptions: ...@@ -54,13 +54,15 @@ The :mod:`queue` module defines the following classes and exceptions:
.. exception:: Empty .. exception:: Empty
Exception raised when non-blocking :meth:`get` (or :meth:`get_nowait`) is called Exception raised when non-blocking :meth:`~Queue.get` (or
:meth:`~Queue.get_nowait`) is called
on a :class:`Queue` object which is empty. on a :class:`Queue` object which is empty.
.. exception:: Full .. exception:: Full
Exception raised when non-blocking :meth:`put` (or :meth:`put_nowait`) is called Exception raised when non-blocking :meth:`~Queue.put` (or
:meth:`~Queue.put_nowait`) is called
on a :class:`Queue` object which is full. on a :class:`Queue` object which is full.
...@@ -181,6 +183,6 @@ Example of how to wait for enqueued tasks to be completed:: ...@@ -181,6 +183,6 @@ Example of how to wait for enqueued tasks to be completed::
context. context.
:class:`collections.deque` is an alternative implementation of unbounded :class:`collections.deque` is an alternative implementation of unbounded
queues with fast atomic :func:`append` and :func:`popleft` operations that queues with fast atomic :meth:`~collections.deque.append` and
do not require locking. :meth:`~collections.deque.popleft` operations that do not require locking.
...@@ -81,7 +81,7 @@ The module defines the following: ...@@ -81,7 +81,7 @@ The module defines the following:
This is a straightforward interface to the Unix :c:func:`select` system call. This is a straightforward interface to the Unix :c:func:`select` system call.
The first three arguments are sequences of 'waitable objects': either The first three arguments are sequences of 'waitable objects': either
integers representing file descriptors or objects with a parameterless method integers representing file descriptors or objects with a parameterless method
named :meth:`fileno` returning such an integer: named :meth:`~io.IOBase.fileno` returning such an integer:
* *rlist*: wait until ready for reading * *rlist*: wait until ready for reading
* *wlist*: wait until ready for writing * *wlist*: wait until ready for writing
...@@ -107,8 +107,8 @@ The module defines the following: ...@@ -107,8 +107,8 @@ The module defines the following:
objects <file object>` (e.g. ``sys.stdin``, or objects returned by objects <file object>` (e.g. ``sys.stdin``, or objects returned by
:func:`open` or :func:`os.popen`), socket objects returned by :func:`open` or :func:`os.popen`), socket objects returned by
:func:`socket.socket`. You may also define a :dfn:`wrapper` class yourself, :func:`socket.socket`. You may also define a :dfn:`wrapper` class yourself,
as long as it has an appropriate :meth:`fileno` method (that really returns as long as it has an appropriate :meth:`~io.IOBase.fileno` method (that
a file descriptor, not just a random integer). really returns a file descriptor, not just a random integer).
.. note:: .. note::
...@@ -122,7 +122,7 @@ The module defines the following: ...@@ -122,7 +122,7 @@ The module defines the following:
.. attribute:: PIPE_BUF .. attribute:: PIPE_BUF
The minimum number of bytes which can be written without blocking to a pipe The minimum number of bytes which can be written without blocking to a pipe
when the pipe has been reported as ready for writing by :func:`select`, when the pipe has been reported as ready for writing by :func:`~select.select`,
:func:`poll` or another interface in this module. This doesn't apply :func:`poll` or another interface in this module. This doesn't apply
to other kind of file-like objects such as sockets. to other kind of file-like objects such as sockets.
...@@ -171,10 +171,10 @@ object. ...@@ -171,10 +171,10 @@ object.
.. method:: devpoll.register(fd[, eventmask]) .. method:: devpoll.register(fd[, eventmask])
Register a file descriptor with the polling object. Future calls to the Register a file descriptor with the polling object. Future calls to the
:meth:`poll` method will then check whether the file descriptor has any pending :meth:`poll` method will then check whether the file descriptor has any
I/O events. *fd* can be either an integer, or an object with a :meth:`fileno` pending I/O events. *fd* can be either an integer, or an object with a
method that returns an integer. File objects implement :meth:`fileno`, so they :meth:`~io.IOBase.fileno` method that returns an integer. File objects
can also be used as the argument. implement :meth:`!fileno`, so they can also be used as the argument.
*eventmask* is an optional bitmask describing the type of events you want to *eventmask* is an optional bitmask describing the type of events you want to
check for. The constants are the same that with :c:func:`poll` check for. The constants are the same that with :c:func:`poll`
...@@ -200,7 +200,7 @@ object. ...@@ -200,7 +200,7 @@ object.
Remove a file descriptor being tracked by a polling object. Just like the Remove a file descriptor being tracked by a polling object. Just like the
:meth:`register` method, *fd* can be an integer or an object with a :meth:`register` method, *fd* can be an integer or an object with a
:meth:`fileno` method that returns an integer. :meth:`~io.IOBase.fileno` method that returns an integer.
Attempting to remove a file descriptor that was never registered is Attempting to remove a file descriptor that was never registered is
safely ignored. safely ignored.
...@@ -317,10 +317,10 @@ linearly scanned again. :c:func:`select` is O(highest file descriptor), while ...@@ -317,10 +317,10 @@ linearly scanned again. :c:func:`select` is O(highest file descriptor), while
.. method:: poll.register(fd[, eventmask]) .. method:: poll.register(fd[, eventmask])
Register a file descriptor with the polling object. Future calls to the Register a file descriptor with the polling object. Future calls to the
:meth:`poll` method will then check whether the file descriptor has any pending :meth:`poll` method will then check whether the file descriptor has any
I/O events. *fd* can be either an integer, or an object with a :meth:`fileno` pending I/O events. *fd* can be either an integer, or an object with a
method that returns an integer. File objects implement :meth:`fileno`, so they :meth:`~io.IOBase.fileno` method that returns an integer. File objects
can also be used as the argument. implement :meth:`!fileno`, so they can also be used as the argument.
*eventmask* is an optional bitmask describing the type of events you want to *eventmask* is an optional bitmask describing the type of events you want to
check for, and can be a combination of the constants :const:`POLLIN`, check for, and can be a combination of the constants :const:`POLLIN`,
...@@ -359,7 +359,7 @@ linearly scanned again. :c:func:`select` is O(highest file descriptor), while ...@@ -359,7 +359,7 @@ linearly scanned again. :c:func:`select` is O(highest file descriptor), while
Remove a file descriptor being tracked by a polling object. Just like the Remove a file descriptor being tracked by a polling object. Just like the
:meth:`register` method, *fd* can be an integer or an object with a :meth:`register` method, *fd* can be an integer or an object with a
:meth:`fileno` method that returns an integer. :meth:`~io.IOBase.fileno` method that returns an integer.
Attempting to remove a file descriptor that was never registered causes a Attempting to remove a file descriptor that was never registered causes a
:exc:`KeyError` exception to be raised. :exc:`KeyError` exception to be raised.
...@@ -424,8 +424,8 @@ http://www.freebsd.org/cgi/man.cgi?query=kqueue&sektion=2 ...@@ -424,8 +424,8 @@ http://www.freebsd.org/cgi/man.cgi?query=kqueue&sektion=2
Value used to identify the event. The interpretation depends on the filter Value used to identify the event. The interpretation depends on the filter
but it's usually the file descriptor. In the constructor ident can either but it's usually the file descriptor. In the constructor ident can either
be an int or an object with a fileno() function. kevent stores the integer be an int or an object with a :meth:`~io.IOBase.fileno` method. kevent
internally. stores the integer internally.
.. attribute:: kevent.filter .. attribute:: kevent.filter
......
...@@ -76,7 +76,7 @@ use cases, the underlying :class:`Popen` interface can be used directly. ...@@ -76,7 +76,7 @@ use cases, the underlying :class:`Popen` interface can be used directly.
Run command with arguments. Wait for command to complete. If the return Run command with arguments. Wait for command to complete. If the return
code was zero then return, otherwise raise :exc:`CalledProcessError`. The code was zero then return, otherwise raise :exc:`CalledProcessError`. The
:exc:`CalledProcessError` object will have the return code in the :exc:`CalledProcessError` object will have the return code in the
:attr:`returncode` attribute. :attr:`~CalledProcessError.returncode` attribute.
The arguments shown above are merely the most common ones, described below The arguments shown above are merely the most common ones, described below
in :ref:`frequently-used-arguments` (hence the use of keyword-only notation in :ref:`frequently-used-arguments` (hence the use of keyword-only notation
...@@ -122,8 +122,8 @@ use cases, the underlying :class:`Popen` interface can be used directly. ...@@ -122,8 +122,8 @@ use cases, the underlying :class:`Popen` interface can be used directly.
If the return code was non-zero it raises a :exc:`CalledProcessError`. The If the return code was non-zero it raises a :exc:`CalledProcessError`. The
:exc:`CalledProcessError` object will have the return code in the :exc:`CalledProcessError` object will have the return code in the
:attr:`returncode` attribute and any output in the :attr:`output` :attr:`~CalledProcessError.returncode` attribute and any output in the
attribute. :attr:`~CalledProcessError.output` attribute.
The arguments shown above are merely the most common ones, described below The arguments shown above are merely the most common ones, described below
in :ref:`frequently-used-arguments` (hence the use of keyword-only notation in :ref:`frequently-used-arguments` (hence the use of keyword-only notation
...@@ -617,14 +617,14 @@ Instances of the :class:`Popen` class have the following methods: ...@@ -617,14 +617,14 @@ Instances of the :class:`Popen` class have the following methods:
.. method:: Popen.poll() .. method:: Popen.poll()
Check if child process has terminated. Set and return :attr:`returncode` Check if child process has terminated. Set and return
attribute. :attr:`~Popen.returncode` attribute.
.. method:: Popen.wait(timeout=None) .. method:: Popen.wait(timeout=None)
Wait for child process to terminate. Set and return :attr:`returncode` Wait for child process to terminate. Set and return
attribute. :attr:`~Popen.returncode` attribute.
If the process does not terminate after *timeout* seconds, raise a If the process does not terminate after *timeout* seconds, raise a
:exc:`TimeoutExpired` exception. It is safe to catch this exception and :exc:`TimeoutExpired` exception. It is safe to catch this exception and
...@@ -868,8 +868,8 @@ In this section, "a becomes b" means that b can be used as a replacement for a. ...@@ -868,8 +868,8 @@ In this section, "a becomes b" means that b can be used as a replacement for a.
In addition, the replacements using :func:`check_output` will fail with a In addition, the replacements using :func:`check_output` will fail with a
:exc:`CalledProcessError` if the requested operation produces a non-zero :exc:`CalledProcessError` if the requested operation produces a non-zero
return code. The output is still available as the ``output`` attribute of return code. The output is still available as the
the raised exception. :attr:`~CalledProcessError.output` attribute of the raised exception.
In the following examples, we assume that the relevant functions have already In the following examples, we assume that the relevant functions have already
been imported from the :mod:`subprocess` module. been imported from the :mod:`subprocess` module.
......
...@@ -63,7 +63,7 @@ This module defines the following functions: ...@@ -63,7 +63,7 @@ This module defines the following functions:
Set a trace function for all threads started from the :mod:`threading` module. Set a trace function for all threads started from the :mod:`threading` module.
The *func* will be passed to :func:`sys.settrace` for each thread, before its The *func* will be passed to :func:`sys.settrace` for each thread, before its
:meth:`run` method is called. :meth:`~Thread.run` method is called.
.. function:: setprofile(func) .. function:: setprofile(func)
...@@ -72,7 +72,7 @@ This module defines the following functions: ...@@ -72,7 +72,7 @@ This module defines the following functions:
Set a profile function for all threads started from the :mod:`threading` module. Set a profile function for all threads started from the :mod:`threading` module.
The *func* will be passed to :func:`sys.setprofile` for each thread, before its The *func* will be passed to :func:`sys.setprofile` for each thread, before its
:meth:`run` method is called. :meth:`~Thread.run` method is called.
.. function:: stack_size([size]) .. function:: stack_size([size])
...@@ -825,10 +825,11 @@ This class represents an action that should be run only after a certain amount ...@@ -825,10 +825,11 @@ This class represents an action that should be run only after a certain amount
of time has passed --- a timer. :class:`Timer` is a subclass of :class:`Thread` of time has passed --- a timer. :class:`Timer` is a subclass of :class:`Thread`
and as such also functions as an example of creating custom threads. and as such also functions as an example of creating custom threads.
Timers are started, as with threads, by calling their :meth:`start` method. The Timers are started, as with threads, by calling their :meth:`~Timer.start`
timer can be stopped (before its action has begun) by calling the :meth:`cancel` method. The timer can be stopped (before its action has begun) by calling the
method. The interval the timer will wait before executing its action may not be :meth:`~Timer.cancel` method. The interval the timer will wait before
exactly the same as the interval specified by the user. executing its action may not be exactly the same as the interval specified by
the user.
For example:: For example::
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment