Commit 8429b678 authored by Ezio Melotti's avatar Ezio Melotti

#15831: merge with 3.2

parents c2085dd7 e0add764
...@@ -130,9 +130,12 @@ command-line arguments from :data:`sys.argv`. ...@@ -130,9 +130,12 @@ command-line arguments from :data:`sys.argv`.
ArgumentParser objects ArgumentParser objects
---------------------- ----------------------
.. class:: ArgumentParser([description], [epilog], [prog], [usage], [add_help], \ .. class:: ArgumentParser(prog=None, usage=None, description=None, \
[argument_default], [parents], [prefix_chars], \ epilog=None, parents=[], \
[conflict_handler], [formatter_class]) formatter_class=argparse.HelpFormatter, \
prefix_chars='-', fromfile_prefix_chars=None, \
argument_default=None, conflict_handler='error', \
add_help=True)
Create a new :class:`ArgumentParser` object. Each parameter has its own more Create a new :class:`ArgumentParser` object. Each parameter has its own more
detailed description below, but in short they are: detailed description below, but in short they are:
......
...@@ -1051,7 +1051,8 @@ ConfigParser Objects ...@@ -1051,7 +1051,8 @@ ConfigParser Objects
*fallback*. *fallback*.
.. method:: items([section], raw=False, vars=None) .. method:: items(raw=False, vars=None)
items(section, raw=False, vars=None)
When *section* is not given, return a list of *section_name*, When *section* is not given, return a list of *section_name*,
*section_proxy* pairs, including DEFAULTSECT. *section_proxy* pairs, including DEFAULTSECT.
......
...@@ -377,7 +377,8 @@ The module :mod:`curses` defines the following functions: ...@@ -377,7 +377,8 @@ The module :mod:`curses` defines the following functions:
is to be displayed. is to be displayed.
.. function:: newwin([nlines, ncols,] begin_y, begin_x) .. function:: newwin(begin_y, begin_x)
newwin(nlines, ncols, begin_y, begin_x)
Return a new window, whose left-upper corner is at ``(begin_y, begin_x)``, and Return a new window, whose left-upper corner is at ``(begin_y, begin_x)``, and
whose height/width is *nlines*/*ncols*. whose height/width is *nlines*/*ncols*.
...@@ -656,7 +657,8 @@ Window objects, as returned by :func:`initscr` and :func:`newwin` above, have ...@@ -656,7 +657,8 @@ Window objects, as returned by :func:`initscr` and :func:`newwin` above, have
the following methods and attributes: the following methods and attributes:
.. method:: window.addch([y, x,] ch[, attr]) .. method:: window.addch(ch[, attr])
window.addch(y, x, ch[, attr])
.. note:: .. note::
...@@ -670,13 +672,15 @@ the following methods and attributes: ...@@ -670,13 +672,15 @@ the following methods and attributes:
position and attributes are the current settings for the window object. position and attributes are the current settings for the window object.
.. method:: window.addnstr([y, x,] str, n[, attr]) .. method:: window.addnstr(str, n[, attr])
window.addnstr(y, x, str, n[, attr])
Paint at most *n* characters of the string *str* at ``(y, x)`` with attributes Paint at most *n* characters of the string *str* at ``(y, x)`` with attributes
*attr*, overwriting anything previously on the display. *attr*, overwriting anything previously on the display.
.. method:: window.addstr([y, x,] str[, attr]) .. method:: window.addstr(str[, attr])
window.addstr(y, x, str[, attr])
Paint the string *str* at ``(y, x)`` with attributes *attr*, overwriting Paint the string *str* at ``(y, x)`` with attributes *attr*, overwriting
anything previously on the display. anything previously on the display.
...@@ -763,7 +767,10 @@ the following methods and attributes: ...@@ -763,7 +767,10 @@ the following methods and attributes:
*bs* are *horch*. The default corner characters are always used by this function. *bs* are *horch*. The default corner characters are always used by this function.
.. method:: window.chgat([y, x, ] [num,] attr) .. method:: window.chgat(attr)
window.chgat(num, attr)
window.chgat(y, x, attr)
window.chgat(y, x, num, attr)
Set the attributes of *num* characters at the current cursor position, or at Set the attributes of *num* characters at the current cursor position, or at
position ``(y, x)`` if supplied. If no value of *num* is given or *num* = -1, position ``(y, x)`` if supplied. If no value of *num* is given or *num* = -1,
...@@ -812,7 +819,8 @@ the following methods and attributes: ...@@ -812,7 +819,8 @@ the following methods and attributes:
Delete the line under the cursor. All following lines are moved up by one line. Delete the line under the cursor. All following lines are moved up by one line.
.. method:: window.derwin([nlines, ncols,] begin_y, begin_x) .. method:: window.derwin(begin_y, begin_x)
window.derwin(nlines, ncols, begin_y, begin_x)
An abbreviation for "derive window", :meth:`derwin` is the same as calling An abbreviation for "derive window", :meth:`derwin` is the same as calling
:meth:`subwin`, except that *begin_y* and *begin_x* are relative to the origin :meth:`subwin`, except that *begin_y* and *begin_x* are relative to the origin
...@@ -906,7 +914,8 @@ the following methods and attributes: ...@@ -906,7 +914,8 @@ the following methods and attributes:
upper-left corner. upper-left corner.
.. method:: window.hline([y, x,] ch, n) .. method:: window.hline(ch, n)
window.hline(y, x, ch, n)
Display a horizontal line starting at ``(y, x)`` with length *n* consisting of Display a horizontal line starting at ``(y, x)`` with length *n* consisting of
the character *ch*. the character *ch*.
...@@ -940,7 +949,8 @@ the following methods and attributes: ...@@ -940,7 +949,8 @@ the following methods and attributes:
the character proper, and upper bits are the attributes. the character proper, and upper bits are the attributes.
.. method:: window.insch([y, x,] ch[, attr]) .. method:: window.insch(ch[, attr])
window.insch(y, x, ch[, attr])
Paint character *ch* at ``(y, x)`` with attributes *attr*, moving the line from Paint character *ch* at ``(y, x)`` with attributes *attr*, moving the line from
position *x* right by one character. position *x* right by one character.
...@@ -961,7 +971,8 @@ the following methods and attributes: ...@@ -961,7 +971,8 @@ the following methods and attributes:
line. line.
.. method:: window.insnstr([y, x,] str, n [, attr]) .. method:: window.insnstr(str, n[, attr])
window.insnstr(y, x, str, n[, attr])
Insert a character string (as many characters as will fit on the line) before Insert a character string (as many characters as will fit on the line) before
the character under the cursor, up to *n* characters. If *n* is zero or the character under the cursor, up to *n* characters. If *n* is zero or
...@@ -970,7 +981,8 @@ the following methods and attributes: ...@@ -970,7 +981,8 @@ the following methods and attributes:
The cursor position does not change (after moving to *y*, *x*, if specified). The cursor position does not change (after moving to *y*, *x*, if specified).
.. method:: window.insstr([y, x, ] str [, attr]) .. method:: window.insstr(str[, attr])
window.insstr(y, x, str[, attr])
Insert a character string (as many characters as will fit on the line) before Insert a character string (as many characters as will fit on the line) before
the character under the cursor. All characters to the right of the cursor are the character under the cursor. All characters to the right of the cursor are
...@@ -978,7 +990,8 @@ the following methods and attributes: ...@@ -978,7 +990,8 @@ the following methods and attributes:
position does not change (after moving to *y*, *x*, if specified). position does not change (after moving to *y*, *x*, if specified).
.. method:: window.instr([y, x] [, n]) .. method:: window.instr([n])
window.instr(y, x[, n])
Return a string of characters, extracted from the window starting at the Return a string of characters, extracted from the window starting at the
current cursor position, or at *y*, *x* if specified. Attributes are stripped current cursor position, or at *y*, *x* if specified. Attributes are stripped
...@@ -1153,13 +1166,15 @@ the following methods and attributes: ...@@ -1153,13 +1166,15 @@ the following methods and attributes:
Turn on attribute *A_STANDOUT*. Turn on attribute *A_STANDOUT*.
.. method:: window.subpad([nlines, ncols,] begin_y, begin_x) .. method:: window.subpad(begin_y, begin_x)
window.subpad(nlines, ncols, begin_y, begin_x)
Return a sub-window, whose upper-left corner is at ``(begin_y, begin_x)``, and Return a sub-window, whose upper-left corner is at ``(begin_y, begin_x)``, and
whose width/height is *ncols*/*nlines*. whose width/height is *ncols*/*nlines*.
.. method:: window.subwin([nlines, ncols,] begin_y, begin_x) .. method:: window.subwin(begin_y, begin_x)
window.subwin(nlines, ncols, begin_y, begin_x)
Return a sub-window, whose upper-left corner is at ``(begin_y, begin_x)``, and Return a sub-window, whose upper-left corner is at ``(begin_y, begin_x)``, and
whose width/height is *ncols*/*nlines*. whose width/height is *ncols*/*nlines*.
...@@ -1216,7 +1231,8 @@ the following methods and attributes: ...@@ -1216,7 +1231,8 @@ the following methods and attributes:
:meth:`refresh`. :meth:`refresh`.
.. method:: window.vline([y, x,] ch, n) .. method:: window.vline(ch, n)
window.vline(y, x, ch, n)
Display a vertical line starting at ``(y, x)`` with length *n* consisting of the Display a vertical line starting at ``(y, x)`` with length *n* consisting of the
character *ch*. character *ch*.
......
...@@ -725,11 +725,16 @@ are always available. They are listed here in alphabetical order. ...@@ -725,11 +725,16 @@ are always available. They are listed here in alphabetical order.
already arranged into argument tuples, see :func:`itertools.starmap`\. already arranged into argument tuples, see :func:`itertools.starmap`\.
.. function:: max(iterable[, args...], *[, key]) .. function:: max(iterable, *[, key])
max(arg1, arg2, *args[, key])
With a single argument *iterable*, return the largest item of a non-empty Return the largest item in an iterable or the largest of two or more
iterable (such as a string, tuple or list). With more than one argument, return arguments.
the largest of the arguments.
If one positional argument is provided, *iterable* must be a non-empty
iterable (such as a non-empty string, tuple or list). The largest item
in the iterable is returned. If two or more positional arguments are
provided, the largest of the positional arguments is returned.
The optional keyword-only *key* argument specifies a one-argument ordering The optional keyword-only *key* argument specifies a one-argument ordering
function like that used for :meth:`list.sort`. function like that used for :meth:`list.sort`.
...@@ -748,11 +753,16 @@ are always available. They are listed here in alphabetical order. ...@@ -748,11 +753,16 @@ are always available. They are listed here in alphabetical order.
:ref:`typememoryview` for more information. :ref:`typememoryview` for more information.
.. function:: min(iterable[, args...], *[, key]) .. function:: min(iterable, *[, key])
min(arg1, arg2, *args[, key])
Return the smallest item in an iterable or the smallest of two or more
arguments.
With a single argument *iterable*, return the smallest item of a non-empty If one positional argument is provided, *iterable* must be a non-empty
iterable (such as a string, tuple or list). With more than one argument, return iterable (such as a non-empty string, tuple or list). The smallest item
the smallest of the arguments. in the iterable is returned. If two or more positional arguments are
provided, the smallest of the positional arguments is returned.
The optional keyword-only *key* argument specifies a one-argument ordering The optional keyword-only *key* argument specifies a one-argument ordering
function like that used for :meth:`list.sort`. function like that used for :meth:`list.sort`.
...@@ -970,16 +980,16 @@ are always available. They are listed here in alphabetical order. ...@@ -970,16 +980,16 @@ are always available. They are listed here in alphabetical order.
must be of integer types, and *y* must be non-negative. must be of integer types, and *y* must be non-negative.
.. function:: print([object, ...], *, sep=' ', end='\\n', file=sys.stdout, flush=False) .. function:: print(*objects, sep=' ', end='\\n', file=sys.stdout, flush=False)
Print *object*\(s) to the stream *file*, separated by *sep* and followed by Print *objects* to the stream *file*, separated by *sep* and followed by
*end*. *sep*, *end* and *file*, if present, must be given as keyword *end*. *sep*, *end* and *file*, if present, must be given as keyword
arguments. arguments.
All non-keyword arguments are converted to strings like :func:`str` does and All non-keyword arguments are converted to strings like :func:`str` does and
written to the stream, separated by *sep* and followed by *end*. Both *sep* written to the stream, separated by *sep* and followed by *end*. Both *sep*
and *end* must be strings; they can also be ``None``, which means to use the and *end* must be strings; they can also be ``None``, which means to use the
default values. If no *object* is given, :func:`print` will just write default values. If no *objects* are given, :func:`print` will just write
*end*. *end*.
The *file* argument must be an object with a ``write(string)`` method; if it The *file* argument must be an object with a ``write(string)`` method; if it
...@@ -1061,7 +1071,8 @@ are always available. They are listed here in alphabetical order. ...@@ -1061,7 +1071,8 @@ are always available. They are listed here in alphabetical order.
.. _func-range: .. _func-range:
.. function:: range([start,] stop[, step]) .. function:: range(stop)
range(start, stop[, step])
:noindex: :noindex:
Rather than being a function, :class:`range` is actually an immutable Rather than being a function, :class:`range` is actually an immutable
...@@ -1126,7 +1137,8 @@ are always available. They are listed here in alphabetical order. ...@@ -1126,7 +1137,8 @@ are always available. They are listed here in alphabetical order.
``x.foobar = 123``. ``x.foobar = 123``.
.. function:: slice([start,] stop[, step]) .. function:: slice(stop)
slice(start, stop[, step])
.. index:: single: Numerical Python .. index:: single: Numerical Python
......
...@@ -27,7 +27,8 @@ HTTPS protocols. It is normally not used directly --- the module ...@@ -27,7 +27,8 @@ HTTPS protocols. It is normally not used directly --- the module
The module provides the following classes: The module provides the following classes:
.. class:: HTTPConnection(host, port=None[, strict[, timeout[, source_address]]]) .. class:: HTTPConnection(host, port=None[, strict][, timeout], \
source_address=None)
An :class:`HTTPConnection` instance represents one transaction with an HTTP An :class:`HTTPConnection` instance represents one transaction with an HTTP
server. It should be instantiated passing it a host and optional port server. It should be instantiated passing it a host and optional port
...@@ -55,7 +56,10 @@ The module provides the following classes: ...@@ -55,7 +56,10 @@ The module provides the following classes:
are not supported anymore. are not supported anymore.
.. class:: HTTPSConnection(host, port=None, key_file=None, cert_file=None[, strict[, timeout[, source_address]]], *, context=None, check_hostname=None) .. class:: HTTPSConnection(host, port=None, key_file=None, \
cert_file=None[, strict][, timeout], \
source_address=None, *, context=None, \
check_hostname=None)
A subclass of :class:`HTTPConnection` that uses SSL for communication with A subclass of :class:`HTTPConnection` that uses SSL for communication with
secure servers. Default port is ``443``. If *context* is specified, it secure servers. Default port is ``443``. If *context* is specified, it
......
...@@ -471,7 +471,7 @@ function. ...@@ -471,7 +471,7 @@ function.
Returns :class:`BoundArguments`, or raises a :exc:`TypeError` if the Returns :class:`BoundArguments`, or raises a :exc:`TypeError` if the
passed arguments do not match the signature. passed arguments do not match the signature.
.. method:: Signature.replace([parameters], *, [return_annotation]) .. method:: Signature.replace(*[, parameters][, return_annotation])
Create a new Signature instance based on the instance replace was invoked Create a new Signature instance based on the instance replace was invoked
on. It is possible to pass different ``parameters`` and/or on. It is possible to pass different ``parameters`` and/or
...@@ -565,7 +565,7 @@ function. ...@@ -565,7 +565,7 @@ function.
... print('Parameter:', param) ... print('Parameter:', param)
Parameter: c Parameter: c
.. method:: Parameter.replace(*, [name], [kind], [default], [annotation]) .. method:: Parameter.replace(*[, name][, kind][, default][, annotation])
Create a new Parameter instance based on the instance replaced was invoked Create a new Parameter instance based on the instance replaced was invoked
on. To override a :class:`Parameter` attribute, pass the corresponding on. To override a :class:`Parameter` attribute, pass the corresponding
......
...@@ -401,7 +401,8 @@ loops that truncate the stream. ...@@ -401,7 +401,8 @@ loops that truncate the stream.
self.currkey = self.keyfunc(self.currvalue) self.currkey = self.keyfunc(self.currvalue)
.. function:: islice(iterable, [start,] stop [, step]) .. function:: islice(iterable, stop)
islice(iterable, start, stop[, step])
Make an iterator that returns selected elements from the iterable. If *start* is Make an iterator that returns selected elements from the iterable. If *start* is
non-zero, then elements from the iterable are skipped until start is reached. non-zero, then elements from the iterable are skipped until start is reached.
......
...@@ -295,7 +295,8 @@ The :mod:`multiprocessing` package mostly replicates the API of the ...@@ -295,7 +295,8 @@ The :mod:`multiprocessing` package mostly replicates the API of the
:class:`Process` and exceptions :class:`Process` and exceptions
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.. class:: Process([group[, target[, name[, args[, kwargs]]]]], *, daemon=None) .. class:: Process(group=None, target=None, name=None, args=(), kwargs={}, \
*, daemon=None)
Process objects represent activity that is run in a separate process. The Process objects represent activity that is run in a separate process. The
:class:`Process` class has equivalents of all the methods of :class:`Process` class has equivalents of all the methods of
......
...@@ -273,7 +273,8 @@ You're free to define as many short option strings and as many long option ...@@ -273,7 +273,8 @@ You're free to define as many short option strings and as many long option
strings as you like (including zero), as long as there is at least one option strings as you like (including zero), as long as there is at least one option
string overall. string overall.
The option strings passed to :meth:`add_option` are effectively labels for the The option strings passed to :meth:`OptionParser.add_option` are effectively
labels for the
option defined by that call. For brevity, we will frequently refer to option defined by that call. For brevity, we will frequently refer to
*encountering an option* on the command line; in reality, :mod:`optparse` *encountering an option* on the command line; in reality, :mod:`optparse`
encounters *option strings* and looks up options from them. encounters *option strings* and looks up options from them.
...@@ -892,7 +893,8 @@ long option strings, but you must specify at least one overall option string. ...@@ -892,7 +893,8 @@ long option strings, but you must specify at least one overall option string.
The canonical way to create an :class:`Option` instance is with the The canonical way to create an :class:`Option` instance is with the
:meth:`add_option` method of :class:`OptionParser`. :meth:`add_option` method of :class:`OptionParser`.
.. method:: OptionParser.add_option(opt_str[, ...], attr=value, ...) .. method:: OptionParser.add_option(option)
OptionParser.add_option(*opt_str, attr=value, ...)
To define an option with only a short option string:: To define an option with only a short option string::
......
...@@ -67,7 +67,8 @@ the standard audio interface for Linux and recent versions of FreeBSD. ...@@ -67,7 +67,8 @@ the standard audio interface for Linux and recent versions of FreeBSD.
``ossaudiodev.error``.) ``ossaudiodev.error``.)
.. function:: open([device, ]mode) .. function:: open(mode)
open(device, mode)
Open an audio device and return an OSS audio device object. This object Open an audio device and return an OSS audio device object. This object
supports many file-like methods, such as :meth:`read`, :meth:`write`, and supports many file-like methods, such as :meth:`read`, :meth:`write`, and
......
...@@ -52,20 +52,20 @@ from sources provided by the operating system. ...@@ -52,20 +52,20 @@ from sources provided by the operating system.
Bookkeeping functions: Bookkeeping functions:
.. function:: seed([x], version=2) .. function:: seed(a=None, version=2)
Initialize the random number generator. Initialize the random number generator.
If *x* is omitted or ``None``, the current system time is used. If If *a* is omitted or ``None``, the current system time is used. If
randomness sources are provided by the operating system, they are used randomness sources are provided by the operating system, they are used
instead of the system time (see the :func:`os.urandom` function for details instead of the system time (see the :func:`os.urandom` function for details
on availability). on availability).
If *x* is an int, it is used directly. If *a* is an int, it is used directly.
With version 2 (the default), a :class:`str`, :class:`bytes`, or :class:`bytearray` With version 2 (the default), a :class:`str`, :class:`bytes`, or :class:`bytearray`
object gets converted to an :class:`int` and all of its bits are used. With version 1, object gets converted to an :class:`int` and all of its bits are used. With version 1,
the :func:`hash` of *x* is used instead. the :func:`hash` of *a* is used instead.
.. versionchanged:: 3.2 .. versionchanged:: 3.2
Moved to the version 2 scheme which uses all of the bits in a string seed. Moved to the version 2 scheme which uses all of the bits in a string seed.
...@@ -93,7 +93,8 @@ Bookkeeping functions: ...@@ -93,7 +93,8 @@ Bookkeeping functions:
Functions for integers: Functions for integers:
.. function:: randrange([start,] stop[, step]) .. function:: randrange(stop)
randrange(start, stop[, step])
Return a randomly selected element from ``range(start, stop, step)``. This is Return a randomly selected element from ``range(start, stop, step)``. This is
equivalent to ``choice(range(start, stop, step))``, but doesn't actually build a equivalent to ``choice(range(start, stop, step))``, but doesn't actually build a
......
...@@ -1005,7 +1005,8 @@ correspond to Unix system calls applicable to sockets. ...@@ -1005,7 +1005,8 @@ correspond to Unix system calls applicable to sockets.
much data, if any, was successfully sent. much data, if any, was successfully sent.
.. method:: socket.sendto(bytes[, flags], address) .. method:: socket.sendto(bytes, address)
socket.sendto(bytes, flags, address)
Send data to the socket. The socket should not be connected to a remote socket, Send data to the socket. The socket should not be connected to a remote socket,
since the destination socket is specified by *address*. The optional *flags* since the destination socket is specified by *address*. The optional *flags*
......
...@@ -1235,7 +1235,8 @@ The :class:`range` type represents an immutable sequence of numbers and is ...@@ -1235,7 +1235,8 @@ The :class:`range` type represents an immutable sequence of numbers and is
commonly used for looping a specific number of times in :keyword:`for` commonly used for looping a specific number of times in :keyword:`for`
loops. loops.
.. class:: range([start, ]stop[, step]) .. class:: range(stop)
range(start, stop[, step])
The arguments to the range constructor must be integers (either built-in The arguments to the range constructor must be integers (either built-in
:class:`int` or any object that implements the ``__index__`` special :class:`int` or any object that implements the ``__index__`` special
......
...@@ -17,7 +17,8 @@ library that can speak to a syslog server is available in the ...@@ -17,7 +17,8 @@ library that can speak to a syslog server is available in the
The module defines the following functions: The module defines the following functions:
.. function:: syslog([priority,] message) .. function:: syslog(message)
syslog(priority, message)
Send the string *message* to the system logger. A trailing newline is added Send the string *message* to the system logger. A trailing newline is added
if necessary. Each message is tagged with a priority composed of a if necessary. Each message is tagged with a priority composed of a
......
...@@ -504,7 +504,7 @@ Tix Commands ...@@ -504,7 +504,7 @@ Tix Commands
print(root.tix_configure()) print(root.tix_configure())
.. method:: tixCommand.tix_configure([cnf,] **kw) .. method:: tixCommand.tix_configure(cnf=None, **kw)
Query or modify the configuration options of the Tix application context. If no Query or modify the configuration options of the Tix application context. If no
option is specified, returns a dictionary all of the available options. If option is specified, returns a dictionary all of the available options. If
......
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