Commit e58ce01f authored by Hynek Schlawack's avatar Hynek Schlawack

#14804: Remove [] around optional arguments with default values

Mostly just mechanical removal of []. In some rare cases I've pulled the
default value up into the argument list.
parent ed8cf7a5
......@@ -20,7 +20,7 @@ The following exception is defined:
The :mod:`bdb` module also defines two classes:
.. class:: Breakpoint(self, file, line[, temporary=0[, cond=None [, funcname=None]]])
.. class:: Breakpoint(self, file, line, temporary=0, cond=None , funcname=None)
This class implements temporary breakpoints, ignore counts, disabling and
(re-)enabling, and conditionals.
......@@ -245,7 +245,7 @@ The :mod:`bdb` module also defines two classes:
breakpoints. These methods return a string containing an error message if
something went wrong, or ``None`` if all is well.
.. method:: set_break(filename, lineno[, temporary=0[, cond[, funcname]]])
.. method:: set_break(filename, lineno, temporary=0, cond=None, funcname=None)
Set a new breakpoint. If the *lineno* line doesn't exist for the
*filename* passed as argument, return an error message. The *filename*
......
......@@ -162,7 +162,7 @@ The :mod:`csv` module defines the following functions:
The :mod:`csv` module defines the following classes:
.. class:: DictReader(csvfile[, fieldnames=None[, restkey=None[, restval=None[, dialect='excel'[, *args, **kwds]]]]])
.. class:: DictReader(csvfile, fieldnames=None, restkey=None, restval=None, dialect='excel', *args, **kwds)
Create an object which operates like a regular reader but maps the information
read into a dict whose keys are given by the optional *fieldnames* parameter.
......@@ -175,7 +175,7 @@ The :mod:`csv` module defines the following classes:
the underlying :class:`reader` instance.
.. class:: DictWriter(csvfile, fieldnames[, restval=''[, extrasaction='raise'[, dialect='excel'[, *args, **kwds]]]])
.. class:: DictWriter(csvfile, fieldnames, restval='', extrasaction='raise', dialect='excel', *args, **kwds)
Create an object which operates like a regular writer but maps dictionaries onto
output rows. The *fieldnames* parameter identifies the order in which values in
......@@ -219,7 +219,7 @@ The :mod:`csv` module defines the following classes:
The :class:`Sniffer` class provides two methods:
.. method:: sniff(sample[, delimiters=None])
.. method:: sniff(sample, delimiters=None)
Analyze the given *sample* and return a :class:`Dialect` subclass
reflecting the parameters found. If the optional *delimiters* parameter
......
......@@ -84,7 +84,7 @@ diffs. For comparing directories and files, see also, the :mod:`filecmp` module.
The constructor for this class is:
.. function:: __init__([tabsize][, wrapcolumn][, linejunk][, charjunk])
.. function:: __init__(tabsize=8, wrapcolumn=None, linejunk=None, charjunk=IS_CHARACTER_JUNK)
Initializes instance of :class:`HtmlDiff`.
......@@ -344,7 +344,7 @@ SequenceMatcher Objects
The :class:`SequenceMatcher` class has this constructor:
.. class:: SequenceMatcher([isjunk[, a[, b[, autojunk=True]]]])
.. class:: SequenceMatcher(isjunk=None, a='', b='', autojunk=True)
Optional argument *isjunk* must be ``None`` (the default) or a one-argument
function that takes a sequence element and returns true if and only if the
......
......@@ -31,7 +31,7 @@ libraries. It allows the program to call arbitrary functions in such a library.
The :mod:`dl` module defines the following function:
.. function:: open(name[, mode=RTLD_LAZY])
.. function:: open(name, mode=RTLD_LAZY)
Open a shared object file, and return a handle. Mode signifies late binding
(:const:`RTLD_LAZY`) or immediate binding (:const:`RTLD_NOW`). Default is
......
......@@ -341,10 +341,10 @@ this module. Most applications will need to derive new writer classes from the
output.
.. class:: DumbWriter([file[, maxcol=72]])
.. class:: DumbWriter(file=None, maxcol=72)
Simple writer class which writes output on the file object passed in as *file*
or, if *file* is omitted, on standard output. The output is simply word-wrapped
or, if *file* is None, on standard output. The output is simply word-wrapped
to the number of columns specified by *maxcol*. This class is suitable for
reflowing a sequence of paragraphs.
......@@ -354,7 +354,7 @@ available. They are listed here in alphabetical order.
Using :func:`divmod` with complex numbers is deprecated.
.. function:: enumerate(sequence[, start=0])
.. function:: enumerate(sequence, start=0)
Return an enumerate object. *sequence* must be a sequence, an
:term:`iterator`, or some other object which supports iteration. The
......@@ -912,7 +912,7 @@ available. They are listed here in alphabetical order.
accidents.)
.. function:: print([object, ...][, sep=' '][, end='\\n'][, file=sys.stdout])
.. function:: print([object, ...], sep=' ', end='\\n', file=sys.stdout)
Print *object*\(s) to the stream *file*, separated by *sep* and followed by
*end*. *sep*, *end* and *file*, if present, must be given as keyword
......
......@@ -89,7 +89,7 @@ The module provides the following classes:
*source_address* was added.
.. class:: HTTPResponse(sock[, debuglevel=0][, strict=0])
.. class:: HTTPResponse(sock, debuglevel=0, strict=0)
Class whose instances are returned upon successful connection. Not instantiated
directly by user.
......
......@@ -627,7 +627,7 @@ loops that truncate the stream.
break
.. function:: tee(iterable[, n=2])
.. function:: tee(iterable, n=2)
Return *n* independent iterators from a single iterable. Equivalent to::
......
......@@ -154,7 +154,7 @@ Maildir, mbox, MH, Babyl, and MMDF.
when the :class:`Mailbox` instance was initialized.
.. method:: get(key[, default=None])
.. method:: get(key, default=None)
__getitem__(key)
Return a representation of the message corresponding to *key*. If no such
......@@ -278,7 +278,7 @@ Maildir, mbox, MH, Babyl, and MMDF.
^^^^^^^^^^^^^^^^
.. class:: Maildir(dirname[, factory=rfc822.Message[, create=True]])
.. class:: Maildir(dirname, factory=rfc822.Message, create=True)
A subclass of :class:`Mailbox` for mailboxes in Maildir format. Parameter
*factory* is a callable object that accepts a file-like message representation
......@@ -423,7 +423,7 @@ Maildir, mbox, MH, Babyl, and MMDF.
^^^^^^^^^^^^^
.. class:: mbox(path[, factory=None[, create=True]])
.. class:: mbox(path, factory=None, create=True)
A subclass of :class:`Mailbox` for mailboxes in mbox format. Parameter *factory*
is a callable object that accepts a file-like message representation (which
......@@ -483,7 +483,7 @@ Maildir, mbox, MH, Babyl, and MMDF.
^^^^^^^^^^^
.. class:: MH(path[, factory=None[, create=True]])
.. class:: MH(path, factory=None, create=True)
A subclass of :class:`Mailbox` for mailboxes in MH format. Parameter *factory*
is a callable object that accepts a file-like message representation (which
......@@ -613,7 +613,7 @@ Maildir, mbox, MH, Babyl, and MMDF.
^^^^^^^^^^^^^^
.. class:: Babyl(path[, factory=None[, create=True]])
.. class:: Babyl(path, factory=None, create=True)
A subclass of :class:`Mailbox` for mailboxes in Babyl format. Parameter
*factory* is a callable object that accepts a file-like message representation
......@@ -689,7 +689,7 @@ Maildir, mbox, MH, Babyl, and MMDF.
^^^^^^^^^^^^^
.. class:: MMDF(path[, factory=None[, create=True]])
.. class:: MMDF(path, factory=None, create=True)
A subclass of :class:`Mailbox` for mailboxes in MMDF format. Parameter *factory*
is a callable object that accepts a file-like message representation (which
......@@ -987,7 +987,7 @@ When a :class:`MaildirMessage` instance is created based upon a
are excluded.
.. method:: set_from(from_[, time_=None])
.. method:: set_from(from_, time_=None)
Set the "From " line to *from_*, which should be specified without a
leading "From " or trailing newline. For convenience, *time_* may be
......@@ -1358,7 +1358,7 @@ When a :class:`BabylMessage` instance is created based upon an
are excluded.
.. method:: set_from(from_[, time_=None])
.. method:: set_from(from_, time_=None)
Set the "From " line to *from_*, which should be specified without a
leading "From " or trailing newline. For convenience, *time_* may be
......
......@@ -1181,7 +1181,7 @@ Files and Directories
doesn't open the FIFO --- it just creates the rendezvous point.
.. function:: mknod(filename[, mode=0600, device])
.. function:: mknod(filename, mode=0600, device=0)
Create a filesystem node (file, device special file or named pipe) named
*filename*. *mode* specifies both the permissions to use and the type of node to
......@@ -1583,7 +1583,7 @@ Files and Directories
Availability: Unix, Windows.
.. function:: walk(top[, topdown=True [, onerror=None[, followlinks=False]]])
.. function:: walk(top, topdown=True, onerror=None, followlinks=False)
.. index::
single: directory; walking
......
......@@ -275,7 +275,7 @@ The following convenience methods combine several ioctls, or one ioctl and some
simple calculations.
.. method:: oss_audio_device.setparameters(format, nchannels, samplerate [, strict=False])
.. method:: oss_audio_device.setparameters(format, nchannels, samplerate, strict=False)
Set the key audio sampling parameters---sample format, number of channels, and
sampling rate---in one method call. *format*, *nchannels*, and *samplerate*
......
......@@ -200,7 +200,7 @@ numbering information.
information is omitted if the flag is false or omitted.
.. function:: compilest(ast[, filename='<syntax-tree>'])
.. function:: compilest(ast, filename='<syntax-tree>')
.. index:: builtin: eval
......
......@@ -20,7 +20,7 @@ useful for Python core developers who are working on the :mod:`pickle` and
probably won't find the :mod:`pickletools` module relevant.
.. function:: dis(pickle[, out=None, memo=None, indentlevel=4])
.. function:: dis(pickle, out=None, memo=None, indentlevel=4)
Outputs a symbolic disassembly of the pickle to the file-like object *out*,
defaulting to ``sys.stdout``. *pickle* can be a string or a file-like object.
......
......@@ -74,7 +74,7 @@ This module defines the following functions:
.. function:: readPlistFromResource(path[, restype='plst'[, resid=0]])
.. function:: readPlistFromResource(path, restype='plst', resid=0)
Read a plist from the resource with type *restype* from the resource fork of
*path*. Availability: Mac OS X.
......@@ -84,7 +84,7 @@ This module defines the following functions:
In Python 3.x, this function has been removed.
.. function:: writePlistToResource(rootObject, path[, restype='plst'[, resid=0]])
.. function:: writePlistToResource(rootObject, path, restype='plst', resid=0)
Write *rootObject* as a resource with type *restype* to the resource fork of
*path*. Availability: Mac OS X.
......
......@@ -298,7 +298,7 @@ Analysis of the profiler data is done using the :class:`Stats` class.
:synopsis: Statistics object for use with the profiler.
.. class:: Stats(filename[, stream=sys.stdout[, ...]])
.. class:: Stats(filename, stream=sys.stdout[, ...])
This class constructor creates an instance of a "statistics object" from a
*filename* (or set of filenames). :class:`Stats` objects are manipulated by
......
......@@ -19,7 +19,7 @@ not implemented in Python, including all standard and optional extension
modules.
.. function:: readmodule(module[, path=None])
.. function:: readmodule(module, path=None)
Read a module and return a dictionary mapping class names to class
descriptor objects. The parameter *module* should be the name of a
......@@ -28,7 +28,7 @@ modules.
of ``sys.path``, which is used to locate module source code.
.. function:: readmodule_ex(module[, path=None])
.. function:: readmodule_ex(module, path=None)
Like :func:`readmodule`, but the returned dictionary, in addition to
mapping class names to class descriptor objects, also maps top-level
......
......@@ -18,7 +18,7 @@ This includes most class instances, recursive data types, and objects containing
lots of shared sub-objects. The keys are ordinary strings.
.. function:: open(filename[, flag='c'[, protocol=None[, writeback=False]]])
.. function:: open(filename, flag='c', protocol=None, writeback=False)
Open a persistent dictionary. The filename specified is the base filename for
the underlying database. As a side-effect, an extension may be added to the
......@@ -100,7 +100,7 @@ Restrictions
implementation used.
.. class:: Shelf(dict[, protocol=None[, writeback=False]])
.. class:: Shelf(dict, protocol=None, writeback=False)
A subclass of :class:`UserDict.DictMixin` which stores pickled values in the
*dict* object.
......@@ -118,7 +118,7 @@ Restrictions
memory and make sync and close take a long time.
.. class:: BsdDbShelf(dict[, protocol=None[, writeback=False]])
.. class:: BsdDbShelf(dict, protocol=None, writeback=False)
A subclass of :class:`Shelf` which exposes :meth:`first`, :meth:`!next`,
:meth:`previous`, :meth:`last` and :meth:`set_location` which are available in
......@@ -129,7 +129,7 @@ Restrictions
the same interpretation as for the :class:`Shelf` class.
.. class:: DbfilenameShelf(filename[, flag='c'[, protocol=None[, writeback=False]]])
.. class:: DbfilenameShelf(filename, flag='c', protocol=None, writeback=False)
A subclass of :class:`Shelf` which accepts a *filename* instead of a dict-like
object. The underlying file will be opened using :func:`anydbm.open`. By
......
......@@ -96,7 +96,7 @@ Directory and files operations
.. versionadded:: 2.6
.. function:: copytree(src, dst[, symlinks=False[, ignore=None]])
.. function:: copytree(src, dst, symlinks=False, ignore=None)
Recursively copy an entire directory tree rooted at *src*. The destination
directory, named by *dst*, must not already exist; it will be created as
......
......@@ -386,7 +386,7 @@ The :mod:`struct` module also defines the following type:
(``len(string)`` must equal :attr:`self.size`).
.. method:: unpack_from(buffer[, offset=0])
.. method:: unpack_from(buffer, offset=0)
Identical to the :func:`unpack_from` function, using the compiled format.
(``len(buffer[offset:])`` must be at least :attr:`self.size`).
......
......@@ -114,7 +114,7 @@ The module also defines three convenience functions:
time. This means that other processes running on the same computer may
interfere with the timing.
.. function:: repeat(stmt[, setup[, timer[, repeat=3 [, number=1000000]]]])
.. function:: repeat(stmt, setup='pass', timer=default_timer, repeat=3 , number=1000000)
Create a :class:`Timer` instance with the given statement, setup code and timer
function and run its :meth:`repeat` method with the given repeat count and
......@@ -123,7 +123,7 @@ The module also defines three convenience functions:
.. versionadded:: 2.6
.. function:: timeit(stmt[, setup[, timer[, number=1000000]]])
.. function:: timeit(stmt, setup='pass', timer=default_timer, number=1000000)
Create a :class:`Timer` instance with the given statement, setup code and timer
function and run its :meth:`timeit` method with *number* executions.
......
......@@ -149,7 +149,7 @@ Programmatic Interface
the current tracing parameters. *cmd* must be a string or code object,
suitable for passing into :func:`exec`.
.. method:: runctx(cmd[, globals=None[, locals=None]])
.. method:: runctx(cmd, globals=None, locals=None)
Execute the command and gather statistics from the execution with the
current tracing parameters, in the defined global and local
......
......@@ -265,7 +265,7 @@ Besides the methods described below, the :class:`ttk.Widget` class supports the
*x* and *y* are pixel coordinates relative to the widget.
.. method:: instate(statespec[, callback=None[, *args[, **kw]]])
.. method:: instate(statespec, callback=None, *args, **kw)
Test the widget's state. If a callback is not specified, returns True
if the widget state matches *statespec* and False otherwise. If callback
......@@ -523,7 +523,7 @@ ttk.Notebook
omitted, returns the widget name of the currently selected pane.
.. method:: tab(tab_id[, option=None[, **kw]])
.. method:: tab(tab_id, option=None, **kw)
Query or modify the options of the specific *tab_id*.
......@@ -846,7 +846,7 @@ ttk.Treeview
.. class:: Treeview
.. method:: bbox(item[, column=None])
.. method:: bbox(item, column=None)
Returns the bounding box (relative to the treeview widget's window) of
the specified *item* in the form (x, y, width, height).
......@@ -873,7 +873,7 @@ ttk.Treeview
*item*'s children.
.. method:: column(column[, option=None[, **kw]])
.. method:: column(column, option=None, **kw)
Query or modify the options for the specified *column*.
......@@ -928,7 +928,7 @@ ttk.Treeview
the current focus item, or '' if there is none.
.. method:: heading(column[, option=None[, **kw]])
.. method:: heading(column, option=None, **kw)
Query or modify the heading options for the specified *column*.
......@@ -1001,7 +1001,7 @@ ttk.Treeview
Returns the integer index of *item* within its parent's list of children.
.. method:: insert(parent, index[, iid=None[, **kw]])
.. method:: insert(parent, index, iid=None, **kw)
Creates a new item and returns the item identifier of the newly created
item.
......@@ -1096,7 +1096,7 @@ ttk.Treeview
Toggle the selection state of each item in *items*.
.. method:: set(item[, column=None[, value=None]])
.. method:: set(item, column=None, value=None)
With one argument, returns a dictionary of column/value pairs for the
specified *item*. With two arguments, returns the current value of the
......@@ -1104,14 +1104,14 @@ ttk.Treeview
*column* in given *item* to the specified *value*.
.. method:: tag_bind(tagname[, sequence=None[, callback=None]])
.. method:: tag_bind(tagname, sequence=None, callback=None)
Bind a callback for the given event *sequence* to the tag *tagname*.
When an event is delivered to an item, the callbacks for each of the
item's tags option are called.
.. method:: tag_configure(tagname[, option=None[, **kw]])
.. method:: tag_configure(tagname, option=None, **kw)
Query or modify the options for the specified *tagname*.
......@@ -1220,7 +1220,7 @@ option. If the class name of a widget is unknown, use the method
foreground option, for example, you would get a blue foreground
when the widget is in the active or pressed states.
.. method:: lookup(style, option[, state=None[, default=None]])
.. method:: lookup(style, option, state=None, default=None)
Returns the value specified for *option* in *style*.
......@@ -1235,7 +1235,7 @@ option. If the class name of a widget is unknown, use the method
print ttk.Style().lookup("TButton", "font")
.. method:: layout(style[, layoutspec=None])
.. method:: layout(style, layoutspec=None)
Define the widget layout for given *style*. If *layoutspec* is omitted,
return the layout specification for given style.
......@@ -1318,7 +1318,7 @@ option. If the class name of a widget is unknown, use the method
Returns the list of *elementname*'s options.
.. method:: theme_create(themename[, parent=None[, settings=None]])
.. method:: theme_create(themename, parent=None, settings=None)
Create a new theme.
......
......@@ -48,7 +48,7 @@ The following exception is defined:
The following functions are defined:
.. function:: open(url[, new=0[, autoraise=True]])
.. function:: open(url, new=0, autoraise=True)
Display *url* using the default browser. If *new* is 0, the *url* is opened
in the same browser window if possible. If *new* is 1, a new browser window
......@@ -178,7 +178,7 @@ Browser controllers provide these methods which parallel three of the
module-level convenience functions:
.. method:: controller.open(url[, new=0[, autoraise=True]])
.. method:: controller.open(url, new=0, autoraise=True)
Display *url* using the browser handled by this controller. If *new* is 1, a new
browser window is opened if possible. If *new* is 2, a new browser page ("tab")
......
......@@ -59,7 +59,7 @@ parameter expect a WSGI-compliant dictionary to be supplied; please see
found, and "http" otherwise.
.. function:: request_uri(environ [, include_query=1])
.. function:: request_uri(environ, include_query=1)
Return the full request URI, optionally including the query string, using the
algorithm found in the "URL Reconstruction" section of :pep:`333`. If
......@@ -148,7 +148,7 @@ also provides these miscellaneous utilities:
:rfc:`2616`.
.. class:: FileWrapper(filelike [, blksize=8192])
.. class:: FileWrapper(filelike, blksize=8192)
A wrapper to convert a file-like object to an :term:`iterator`. The resulting objects
support both :meth:`__getitem__` and :meth:`__iter__` iteration styles, for
......@@ -271,7 +271,7 @@ request. (E.g., using the :func:`shift_path_info` function from
:mod:`wsgiref.util`.)
.. function:: make_server(host, port, app [, server_class=WSGIServer [, handler_class=WSGIRequestHandler]])
.. function:: make_server(host, port, app, server_class=WSGIServer, handler_class=WSGIRequestHandler)
Create a new WSGI server listening on *host* and *port*, accepting connections
for *app*. The return value is an instance of the supplied *server_class*, and
......@@ -460,7 +460,7 @@ input, output, and error streams.
environment.
.. class:: BaseCGIHandler(stdin, stdout, stderr, environ [, multithread=True [, multiprocess=False]])
.. class:: BaseCGIHandler(stdin, stdout, stderr, environ, multithread=True, multiprocess=False)
Similar to :class:`CGIHandler`, but instead of using the :mod:`sys` and
:mod:`os` modules, the CGI environment and I/O streams are specified explicitly.
......@@ -475,7 +475,7 @@ input, output, and error streams.
instead of :class:`SimpleHandler`.
.. class:: SimpleHandler(stdin, stdout, stderr, environ [,multithread=True [, multiprocess=False]])
.. class:: SimpleHandler(stdin, stdout, stderr, environ, multithread=True, multiprocess=False)
Similar to :class:`BaseCGIHandler`, but designed for use with HTTP origin
servers. If you are writing an HTTP server implementation, you will probably
......
......@@ -129,7 +129,7 @@ module documentation. This section lists the differences between the API and
to discard children of that node.
.. method:: Node.writexml(writer[, indent=""[, addindent=""[, newl=""]]])
.. method:: Node.writexml(writer, indent="", addindent="", newl="")
Write XML to the writer object. The writer should have a :meth:`write` method
which matches that of the file object interface. The *indent* parameter is the
......
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