Update signature style for optional arguments, part 3.

This commit is contained in:
Georg Brandl 2009-04-10 09:03:43 +00:00
parent 388faac8cb
commit c2a4f4fb67
14 changed files with 63 additions and 70 deletions

View File

@ -26,7 +26,7 @@ of doing them both.
To do just the former: To do just the former:
.. function:: compile_command(source[, filename[, symbol]]) .. function:: compile_command(source, filename="<input>", symbol="single")
Tries to compile *source*, which should be a string of Python code and return a Tries to compile *source*, which should be a string of Python code and return a
code object if *source* is valid Python code. In that case, the filename code object if *source* is valid Python code. In that case, the filename

View File

@ -286,7 +286,7 @@ counts, but the output will exclude results with counts of zero or less.
:class:`deque` objects :class:`deque` objects
---------------------- ----------------------
.. class:: deque([iterable[, maxlen]]) .. class:: deque([iterable, [maxlen]])
Returns a new deque object initialized left-to-right (using :meth:`append`) with Returns a new deque object initialized left-to-right (using :meth:`append`) with
data from *iterable*. If *iterable* is not specified, the new deque is empty. data from *iterable*. If *iterable* is not specified, the new deque is empty.
@ -605,7 +605,7 @@ Named tuples assign meaning to each position in a tuple and allow for more reada
self-documenting code. They can be used wherever regular tuples are used, and self-documenting code. They can be used wherever regular tuples are used, and
they add the ability to access fields by name instead of position index. they add the ability to access fields by name instead of position index.
.. function:: namedtuple(typename, field_names, [verbose], [rename]) .. function:: namedtuple(typename, field_names, verbose=False, rename=False)
Returns a new tuple subclass named *typename*. The new subclass is used to Returns a new tuple subclass named *typename*. The new subclass is used to
create tuple-like objects that have fields accessible by attribute lookup as create tuple-like objects that have fields accessible by attribute lookup as

View File

@ -20,7 +20,7 @@ sys.path``. Printing lists of the files compiled can be disabled with the
expression argument. All files that match the expression will be skipped. expression argument. All files that match the expression will be skipped.
.. function:: compile_dir(dir[, maxlevels[, ddir[, force[, rx[, quiet]]]]]) .. function:: compile_dir(dir, maxlevels=10, ddir=None, force=False, rx=None, quiet=False)
Recursively descend the directory tree named by *dir*, compiling all :file:`.py` Recursively descend the directory tree named by *dir*, compiling all :file:`.py`
files along the way. The *maxlevels* parameter is used to limit the depth of files along the way. The *maxlevels* parameter is used to limit the depth of
@ -36,7 +36,7 @@ expression argument. All files that match the expression will be skipped.
operation. operation.
.. function:: compile_path([skip_curdir[, maxlevels[, force]]]) .. function:: compile_path(skip_curdir=True, maxlevels=0, force=False)
Byte-compile all the :file:`.py` files found along ``sys.path``. If Byte-compile all the :file:`.py` files found along ``sys.path``. If
*skip_curdir* is true (the default), the current directory is not included in *skip_curdir* is true (the default), the current directory is not included in

View File

@ -56,7 +56,7 @@ dictionary type is passed that sorts its keys, the sections will be sorted on
write-back, as will be the keys within each section. write-back, as will be the keys within each section.
.. class:: RawConfigParser([defaults[, dict_type]]) .. class:: RawConfigParser(defaults=None, dict_type=collections.OrderedDict)
The basic configuration object. When *defaults* is given, it is initialized The basic configuration object. When *defaults* is given, it is initialized
into the dictionary of intrinsic defaults. When *dict_type* is given, it will into the dictionary of intrinsic defaults. When *dict_type* is given, it will
@ -68,7 +68,7 @@ write-back, as will be the keys within each section.
The default *dict_type* is :class:`collections.OrderedDict`. The default *dict_type* is :class:`collections.OrderedDict`.
.. class:: ConfigParser([defaults[, dict_type]]) .. class:: ConfigParser(defaults=None, dict_type=collections.OrderedDict)
Derived class of :class:`RawConfigParser` that implements the magical Derived class of :class:`RawConfigParser` that implements the magical
interpolation feature and adds optional arguments to the :meth:`get` and interpolation feature and adds optional arguments to the :meth:`get` and
@ -87,7 +87,7 @@ write-back, as will be the keys within each section.
The default *dict_type* is :class:`collections.OrderedDict`. The default *dict_type* is :class:`collections.OrderedDict`.
.. class:: SafeConfigParser([defaults[, dict_type]]) .. class:: SafeConfigParser(defaults=None, dict_type=collections.OrderedDict)
Derived class of :class:`ConfigParser` that implements a more-sane variant of Derived class of :class:`ConfigParser` that implements a more-sane variant of
the magical interpolation feature. This implementation is more predictable as the magical interpolation feature. This implementation is more predictable as
@ -228,7 +228,7 @@ RawConfigParser Objects
config.read(['site.cfg', os.path.expanduser('~/.myapp.cfg')]) config.read(['site.cfg', os.path.expanduser('~/.myapp.cfg')])
.. method:: RawConfigParser.readfp(fp[, filename]) .. method:: RawConfigParser.readfp(fp, filename=None)
Read and parse configuration data from the file or file-like object in *fp* Read and parse configuration data from the file or file-like object in *fp*
(only the :meth:`readline` method is used). If *filename* is omitted and *fp* (only the :meth:`readline` method is used). If *filename* is omitted and *fp*
@ -315,7 +315,7 @@ The :class:`ConfigParser` class extends some methods of the
:class:`RawConfigParser` interface, adding some optional arguments. :class:`RawConfigParser` interface, adding some optional arguments.
.. method:: ConfigParser.get(section, option[, raw[, vars]]) .. method:: ConfigParser.get(section, option, raw=False, vars=None)
Get an *option* value for the named *section*. All the ``'%'`` interpolations Get an *option* value for the named *section*. All the ``'%'`` interpolations
are expanded in the return values, based on the defaults passed into the are expanded in the return values, based on the defaults passed into the
@ -323,7 +323,7 @@ The :class:`ConfigParser` class extends some methods of the
is true. is true.
.. method:: ConfigParser.items(section[, raw[, vars]]) .. method:: ConfigParser.items(section, raw=False, vars=None)
Return a list of ``(name, value)`` pairs for each option in the given *section*. Return a list of ``(name, value)`` pairs for each option in the given *section*.
Optional arguments have the same meaning as for the :meth:`get` method. Optional arguments have the same meaning as for the :meth:`get` method.

View File

@ -61,8 +61,8 @@ if the :option:`-S` command-line option is given) adds several constants to the
built-in namespace. They are useful for the interactive interpreter shell and built-in namespace. They are useful for the interactive interpreter shell and
should not be used in programs. should not be used in programs.
.. data:: quit([code=None]) .. data:: quit(code=None)
exit([code=None]) exit(code=None)
Objects that when printed, print a message like "Use quit() or Ctrl-D Objects that when printed, print a message like "Use quit() or Ctrl-D
(i.e. EOF) to exit", and when called, raise :exc:`SystemExit` with the (i.e. EOF) to exit", and when called, raise :exc:`SystemExit` with the

View File

@ -24,7 +24,7 @@ instances.
hence not valid as a constructor), raises :exc:`TypeError`. hence not valid as a constructor), raises :exc:`TypeError`.
.. function:: pickle(type, function[, constructor]) .. function:: pickle(type, function, constructor=None)
Declares that *function* should be used as a "reduction" function for objects Declares that *function* should be used as a "reduction" function for objects
of type *type*. *function* should return either a string or a tuple of type *type*. *function* should return either a string or a tuple

View File

@ -47,7 +47,7 @@ Module Contents
The :mod:`csv` module defines the following functions: The :mod:`csv` module defines the following functions:
.. function:: reader(csvfile[, dialect='excel'][, fmtparam]) .. function:: reader(csvfile, dialect='excel', **fmtparams)
Return a reader object which will iterate over lines in the given *csvfile*. Return a reader object which will iterate over lines in the given *csvfile*.
*csvfile* can be any object which supports the :term:`iterator` protocol and returns a *csvfile* can be any object which supports the :term:`iterator` protocol and returns a
@ -57,7 +57,7 @@ The :mod:`csv` module defines the following functions:
*dialect* parameter can be given which is used to define a set of parameters *dialect* parameter can be given which is used to define a set of parameters
specific to a particular CSV dialect. It may be an instance of a subclass of specific to a particular CSV dialect. It may be an instance of a subclass of
the :class:`Dialect` class or one of the strings returned by the the :class:`Dialect` class or one of the strings returned by the
:func:`list_dialects` function. The other optional *fmtparam* keyword arguments :func:`list_dialects` function. The other optional *fmtparams* keyword arguments
can be given to override individual formatting parameters in the current can be given to override individual formatting parameters in the current
dialect. For full details about the dialect and formatting parameters, see dialect. For full details about the dialect and formatting parameters, see
section :ref:`csv-fmt-params`. section :ref:`csv-fmt-params`.
@ -76,7 +76,7 @@ The :mod:`csv` module defines the following functions:
Spam, Lovely Spam, Wonderful Spam Spam, Lovely Spam, Wonderful Spam
.. function:: writer(csvfile[, dialect='excel'][, fmtparam]) .. function:: writer(csvfile, dialect='excel', **fmtparams)
Return a writer object responsible for converting the user's data into delimited Return a writer object responsible for converting the user's data into delimited
strings on the given file-like object. *csvfile* can be any object with a strings on the given file-like object. *csvfile* can be any object with a
@ -84,7 +84,7 @@ The :mod:`csv` module defines the following functions:
parameter can be given which is used to define a set of parameters specific to a parameter can be given which is used to define a set of parameters specific to a
particular CSV dialect. It may be an instance of a subclass of the particular CSV dialect. It may be an instance of a subclass of the
:class:`Dialect` class or one of the strings returned by the :class:`Dialect` class or one of the strings returned by the
:func:`list_dialects` function. The other optional *fmtparam* keyword arguments :func:`list_dialects` function. The other optional *fmtparams* keyword arguments
can be given to override individual formatting parameters in the current can be given to override individual formatting parameters in the current
dialect. For full details about the dialect and formatting parameters, see dialect. For full details about the dialect and formatting parameters, see
section :ref:`csv-fmt-params`. To make it section :ref:`csv-fmt-params`. To make it
@ -103,11 +103,11 @@ The :mod:`csv` module defines the following functions:
>>> spamWriter.writerow(['Spam', 'Lovely Spam', 'Wonderful Spam']) >>> spamWriter.writerow(['Spam', 'Lovely Spam', 'Wonderful Spam'])
.. function:: register_dialect(name[, dialect][, fmtparam]) .. function:: register_dialect(name[, dialect], **fmtparams)
Associate *dialect* with *name*. *name* must be a string. The Associate *dialect* with *name*. *name* must be a string. The
dialect can be specified either by passing a sub-class of :class:`Dialect`, or dialect can be specified either by passing a sub-class of :class:`Dialect`, or
by *fmtparam* keyword arguments, or both, with keyword arguments overriding by *fmtparams* keyword arguments, or both, with keyword arguments overriding
parameters of the dialect. For full details about the dialect and formatting parameters of the dialect. For full details about the dialect and formatting
parameters, see section :ref:`csv-fmt-params`. parameters, see section :ref:`csv-fmt-params`.
@ -137,7 +137,7 @@ The :mod:`csv` module defines the following functions:
The :mod:`csv` module defines the following classes: 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 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. read into a dict whose keys are given by the optional *fieldnames* parameter.
@ -151,7 +151,7 @@ The :mod:`csv` module defines the following classes:
arguments are passed to the underlying :class:`reader` instance. arguments are passed to 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 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 output rows. The *fieldnames* parameter identifies the order in which values in
@ -195,7 +195,7 @@ The :mod:`csv` module defines the following classes:
The :class:`Sniffer` class provides two methods: 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 Analyze the given *sample* and return a :class:`Dialect` subclass
reflecting the parameters found. If the optional *delimiters* parameter reflecting the parameters found. If the optional *delimiters* parameter

View File

@ -531,7 +531,7 @@ The module :mod:`curses` defines the following functions:
capability, or is canceled or absent from the terminal description. capability, or is canceled or absent from the terminal description.
.. function:: tparm(str[,...]) .. function:: tparm(str[, ...])
Instantiates the string *str* with the supplied parameters, where *str* should Instantiates the string *str* with the supplied parameters, where *str* should
be a parameterized string obtained from the terminfo database. E.g. be a parameterized string obtained from the terminfo database. E.g.

View File

@ -128,7 +128,7 @@ A :class:`timedelta` object represents a duration, the difference between two
dates or times. dates or times.
.. class:: timedelta([days[, seconds[, microseconds[, milliseconds[, minutes[, hours[, weeks]]]]]]]) .. class:: timedelta(days=0, seconds=0, microseconds=0, milliseconds=0, minutes=0, hours=0, weeks=0)
All arguments are optional and default to ``0``. Arguments may be integers All arguments are optional and default to ``0``. Arguments may be integers
or floats, and may be positive or negative. or floats, and may be positive or negative.
@ -570,7 +570,7 @@ both directions; like a time object, :class:`datetime` assumes there are exactly
Constructor: Constructor:
.. class:: datetime(year, month, day[, hour[, minute[, second[, microsecond[, tzinfo]]]]]) .. class:: datetime(year, month, day, hour=0, minute=0, second=0, microsecond=0, tzinfo=None)
The year, month and day arguments are required. *tzinfo* may be ``None``, or an The year, month and day arguments are required. *tzinfo* may be ``None``, or an
instance of a :class:`tzinfo` subclass. The remaining arguments may be integers, instance of a :class:`tzinfo` subclass. The remaining arguments may be integers,
@ -596,7 +596,7 @@ Other constructors, all class methods:
:meth:`fromtimestamp`. :meth:`fromtimestamp`.
.. method:: datetime.now([tz]) .. method:: datetime.now(tz=None)
Return the current local date and time. If optional argument *tz* is ``None`` Return the current local date and time. If optional argument *tz* is ``None``
or not specified, this is like :meth:`today`, but, if possible, supplies more or not specified, this is like :meth:`today`, but, if possible, supplies more
@ -617,7 +617,7 @@ Other constructors, all class methods:
:class:`datetime` object. See also :meth:`now`. :class:`datetime` object. See also :meth:`now`.
.. method:: datetime.fromtimestamp(timestamp[, tz]) .. method:: datetime.fromtimestamp(timestamp, tz=None)
Return the local date and time corresponding to the POSIX timestamp, such as is Return the local date and time corresponding to the POSIX timestamp, such as is
returned by :func:`time.time`. If optional argument *tz* is ``None`` or not returned by :func:`time.time`. If optional argument *tz* is ``None`` or not
@ -947,7 +947,7 @@ Instance methods:
``self.date().isocalendar()``. ``self.date().isocalendar()``.
.. method:: datetime.isoformat([sep]) .. method:: datetime.isoformat(sep='T')
Return a string representing the date and time in ISO 8601 format, Return a string representing the date and time in ISO 8601 format,
YYYY-MM-DDTHH:MM:SS.mmmmmm or, if :attr:`microsecond` is 0, YYYY-MM-DDTHH:MM:SS.mmmmmm or, if :attr:`microsecond` is 0,
@ -1101,7 +1101,7 @@ A time object represents a (local) time of day, independent of any particular
day, and subject to adjustment via a :class:`tzinfo` object. day, and subject to adjustment via a :class:`tzinfo` object.
.. class:: time(hour[, minute[, second[, microsecond[, tzinfo]]]]) .. class:: time(hour=0, minute=0, second=0, microsecond=0, tzinfo=None)
All arguments are optional. *tzinfo* may be ``None``, or an instance of a All arguments are optional. *tzinfo* may be ``None``, or an instance of a
:class:`tzinfo` subclass. The remaining arguments may be integers, in the :class:`tzinfo` subclass. The remaining arguments may be integers, in the

View File

@ -30,7 +30,7 @@
name, such as ``'dbm.ndbm'`` or ``'dbm.gnu'``. name, such as ``'dbm.ndbm'`` or ``'dbm.gnu'``.
.. function:: open(filename[, flag[, mode]]) .. function:: open(filename, flag='r', mode=0o666)
Open the database file *filename* and return a corresponding object. Open the database file *filename* and return a corresponding object.
@ -121,7 +121,7 @@ supported.
raised for general mapping errors like specifying an incorrect key. raised for general mapping errors like specifying an incorrect key.
.. function:: open(filename, [flag, [mode]]) .. function:: open(filename[, flag[, mode]])
Open a ``gdbm`` database and return a :class:`gdbm` object. The *filename* Open a ``gdbm`` database and return a :class:`gdbm` object. The *filename*
argument is the name of the database file. argument is the name of the database file.

View File

@ -305,7 +305,7 @@ Decimal objects
--------------- ---------------
.. class:: Decimal([value [, context]]) .. class:: Decimal(value="0", context=None)
Construct a new :class:`Decimal` object based from *value*. Construct a new :class:`Decimal` object based from *value*.

View File

@ -72,7 +72,7 @@ diffs. For comparing directories and files, see also, the :mod:`filecmp` module.
The constructor for this class is: The constructor for this class is:
.. function:: __init__([tabsize][, wrapcolumn][, linejunk][, charjunk]) .. method:: __init__(tabsize=8, wrapcolumn=None, linejunk=None, charjunk=IS_CHARACTER_JUNK)
Initializes instance of :class:`HtmlDiff`. Initializes instance of :class:`HtmlDiff`.
@ -88,8 +88,7 @@ diffs. For comparing directories and files, see also, the :mod:`filecmp` module.
The following methods are public: The following methods are public:
.. method:: make_file(fromlines, tolines, fromdesc='', todesc='', context=False, numlines=5)
.. function:: make_file(fromlines, tolines [, fromdesc][, todesc][, context][, numlines])
Compares *fromlines* and *tolines* (lists of strings) and returns a string which Compares *fromlines* and *tolines* (lists of strings) and returns a string which
is a complete HTML file containing a table showing line by line differences with is a complete HTML file containing a table showing line by line differences with
@ -108,8 +107,7 @@ diffs. For comparing directories and files, see also, the :mod:`filecmp` module.
the next difference highlight at the top of the browser without any leading the next difference highlight at the top of the browser without any leading
context). context).
.. method:: make_table(fromlines, tolines, fromdesc='', todesc='', context=False, numlines=5)
.. function:: make_table(fromlines, tolines [, fromdesc][, todesc][, context][, numlines])
Compares *fromlines* and *tolines* (lists of strings) and returns a string which Compares *fromlines* and *tolines* (lists of strings) and returns a string which
is a complete HTML table showing line by line differences with inter-line and is a complete HTML table showing line by line differences with inter-line and
@ -122,7 +120,7 @@ diffs. For comparing directories and files, see also, the :mod:`filecmp` module.
contains a good example of its use. contains a good example of its use.
.. function:: context_diff(a, b[, fromfile][, tofile][, fromfiledate][, tofiledate][, n][, lineterm]) .. function:: context_diff(a, b, fromfile='', tofile='', fromfiledate='', tofiledate='', n=3, lineterm='\\n')
Compare *a* and *b* (lists of strings); return a delta (a :term:`generator` Compare *a* and *b* (lists of strings); return a delta (a :term:`generator`
generating the delta lines) in context diff format. generating the delta lines) in context diff format.
@ -167,7 +165,7 @@ diffs. For comparing directories and files, see also, the :mod:`filecmp` module.
See :ref:`difflib-interface` for a more detailed example. See :ref:`difflib-interface` for a more detailed example.
.. function:: get_close_matches(word, possibilities[, n][, cutoff]) .. function:: get_close_matches(word, possibilities, n=3, cutoff=0.6)
Return a list of the best "good enough" matches. *word* is a sequence for which Return a list of the best "good enough" matches. *word* is a sequence for which
close matches are desired (typically a string), and *possibilities* is a list of close matches are desired (typically a string), and *possibilities* is a list of
@ -193,7 +191,7 @@ diffs. For comparing directories and files, see also, the :mod:`filecmp` module.
['except'] ['except']
.. function:: ndiff(a, b[, linejunk][, charjunk]) .. function:: ndiff(a, b, linejunk=None, charjunk=IS_CHARACTER_JUNK)
Compare *a* and *b* (lists of strings); return a :class:`Differ`\ -style Compare *a* and *b* (lists of strings); return a :class:`Differ`\ -style
delta (a :term:`generator` generating the delta lines). delta (a :term:`generator` generating the delta lines).
@ -253,7 +251,7 @@ diffs. For comparing directories and files, see also, the :mod:`filecmp` module.
emu emu
.. function:: unified_diff(a, b[, fromfile][, tofile][, fromfiledate][, tofiledate][, n][, lineterm]) .. function:: unified_diff(a, b, fromfile='', tofile='', fromfiledate='', tofiledate='', n=3, lineterm='\\n')
Compare *a* and *b* (lists of strings); return a delta (a :term:`generator` Compare *a* and *b* (lists of strings); return a delta (a :term:`generator`
generating the delta lines) in unified diff format. generating the delta lines) in unified diff format.
@ -326,7 +324,7 @@ SequenceMatcher Objects
The :class:`SequenceMatcher` class has this constructor: The :class:`SequenceMatcher` class has this constructor:
.. class:: SequenceMatcher([isjunk[, a[, b]]]) .. class:: SequenceMatcher(isjunk=None, a='', b='')
Optional argument *isjunk* must be ``None`` (the default) or a one-argument 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 function that takes a sequence element and returns true if and only if the
@ -467,7 +465,7 @@ The :class:`SequenceMatcher` class has this constructor:
insert a[6:6] () b[5:6] (f) insert a[6:6] () b[5:6] (f)
.. method:: get_grouped_opcodes([n]) .. method:: get_grouped_opcodes(n=3)
Return a :term:`generator` of groups with up to *n* lines of context. Return a :term:`generator` of groups with up to *n* lines of context.
@ -580,7 +578,7 @@ locality, at the occasional cost of producing a longer diff.
The :class:`Differ` class has this constructor: The :class:`Differ` class has this constructor:
.. class:: Differ([linejunk[, charjunk]]) .. class:: Differ(linejunk=None, charjunk=None)
Optional keyword parameters *linejunk* and *charjunk* are for filter functions Optional keyword parameters *linejunk* and *charjunk* are for filter functions
(or ``None``): (or ``None``):

View File

@ -30,22 +30,23 @@ the following command can be used to get the disassembly of :func:`myfunc`::
The :mod:`dis` module defines the following functions and constants: The :mod:`dis` module defines the following functions and constants:
.. function:: dis([bytesource]) .. function:: dis(x=None)
Disassemble the *bytesource* object. *bytesource* can denote either a module, a Disassemble the *x* object. *x* can denote either a module, a
class, a method, a function, or a code object. For a module, it disassembles class, a method, a function, or a code object. For a module, it disassembles
all functions. For a class, it disassembles all methods. For a single code all functions. For a class, it disassembles all methods. For a single code
sequence, it prints one line per bytecode instruction. If no object is sequence, it prints one line per bytecode instruction. If no object is
provided, it disassembles the last traceback. provided, it disassembles the last traceback.
.. function:: distb([tb]) .. function:: distb(tb=None)
Disassembles the top-of-stack function of a traceback, using the last traceback Disassembles the top-of-stack function of a traceback, using the last traceback
if none was passed. The instruction causing the exception is indicated. if none was passed. The instruction causing the exception is indicated.
.. function:: disassemble(code[, lasti]) .. function:: disassemble(code, lasti=-1)
disco(code, lasti=-1)
Disassembles a code object, indicating the last instruction if *lasti* was Disassembles a code object, indicating the last instruction if *lasti* was
provided. The output is divided in the following columns: provided. The output is divided in the following columns:
@ -62,12 +63,6 @@ The :mod:`dis` module defines the following functions and constants:
constant values, branch targets, and compare operators. constant values, branch targets, and compare operators.
.. function:: disco(code[, lasti])
A synonym for :func:`disassemble`. It is more convenient to type, and kept
for compatibility with earlier Python releases.
.. function:: findlinestarts(code) .. function:: findlinestarts(code)
This generator function uses the ``co_firstlineno`` and ``co_lnotab`` This generator function uses the ``co_firstlineno`` and ``co_lnotab``

View File

@ -753,7 +753,7 @@ introduction to these two functions, see sections :ref:`doctest-simple-testmod`
and :ref:`doctest-simple-testfile`. and :ref:`doctest-simple-testfile`.
.. function:: testfile(filename[, module_relative][, name][, package][, globs][, verbose][, report][, optionflags][, extraglobs][, raise_on_error][, parser][, encoding]) .. function:: testfile(filename, module_relative=True, name=None, package=None, globs=None, verbose=None, report=True, optionflags=0, extraglobs=None, raise_on_error=False, parser=DocTestParser(), encoding=None)
All arguments except *filename* are optional, and should be specified in keyword All arguments except *filename* are optional, and should be specified in keyword
form. form.
@ -822,7 +822,7 @@ and :ref:`doctest-simple-testfile`.
convert the file to unicode. convert the file to unicode.
.. function:: testmod([m][, name][, globs][, verbose][, report][, optionflags][, extraglobs][, raise_on_error][, exclude_empty]) .. function:: testmod(m=None, name=None, globs=None, verbose=None, report=True, optionflags=0, extraglobs=None, raise_on_error=False, exclude_empty=False)
All arguments are optional, and all except for *m* should be specified in All arguments are optional, and all except for *m* should be specified in
keyword form. keyword form.
@ -860,7 +860,7 @@ This function is provided for backward compatibility. There are no plans to
deprecate it, but it's rarely useful: deprecate it, but it's rarely useful:
.. function:: run_docstring_examples(f, globs[, verbose][, name][, compileflags][, optionflags]) .. function:: run_docstring_examples(f, globs, verbose=False, name="NoName", compileflags=None, optionflags=0)
Test examples associated with object *f*; for example, *f* may be a module, Test examples associated with object *f*; for example, *f* may be a module,
function, or class object. function, or class object.
@ -905,7 +905,7 @@ There are two main functions for creating :class:`unittest.TestSuite` instances
from text files and modules with doctests: from text files and modules with doctests:
.. function:: DocFileSuite(*paths, [module_relative][, package][, setUp][, tearDown][, globs][, optionflags][, parser][, encoding]) .. function:: DocFileSuite(*paths, module_relative=True, package=None, setUp=None, tearDown=None, globs=None, optionflags=0, parser=DocTestParser(), encoding=None)
Convert doctest tests from one or more text files to a Convert doctest tests from one or more text files to a
:class:`unittest.TestSuite`. :class:`unittest.TestSuite`.
@ -972,7 +972,7 @@ from text files and modules with doctests:
from a text file using :func:`DocFileSuite`. from a text file using :func:`DocFileSuite`.
.. function:: DocTestSuite([module][, globs][, extraglobs][, test_finder][, setUp][, tearDown][, checker]) .. function:: DocTestSuite(module=None, globs=None, extraglobs=None, test_finder=None, setUp=None, tearDown=None, checker=None)
Convert doctest tests for a module to a :class:`unittest.TestSuite`. Convert doctest tests for a module to a :class:`unittest.TestSuite`.
@ -1158,7 +1158,7 @@ Example Objects
^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^
.. class:: Example(source, want[, exc_msg][, lineno][, indent][, options]) .. class:: Example(source, want, exc_msg=None, lineno=0, indent=0, options=None)
A single interactive example, consisting of a Python statement and its expected A single interactive example, consisting of a Python statement and its expected
output. The constructor arguments are used to initialize the member variables output. The constructor arguments are used to initialize the member variables
@ -1220,7 +1220,7 @@ DocTestFinder objects
^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^
.. class:: DocTestFinder([verbose][, parser][, recurse][, exclude_empty]) .. class:: DocTestFinder(verbose=False, parser=DocTestParser(), recurse=True, exclude_empty=True)
A processing class used to extract the :class:`DocTest`\ s that are relevant to A processing class used to extract the :class:`DocTest`\ s that are relevant to
a given object, from its docstring and the docstrings of its contained objects. a given object, from its docstring and the docstrings of its contained objects.
@ -1306,14 +1306,14 @@ DocTestParser objects
information. information.
.. method:: get_examples(string[, name]) .. method:: get_examples(string, name='<string>')
Extract all doctest examples from the given string, and return them as a list Extract all doctest examples from the given string, and return them as a list
of :class:`Example` objects. Line numbers are 0-based. The optional argument of :class:`Example` objects. Line numbers are 0-based. The optional argument
*name* is a name identifying this string, and is only used for error messages. *name* is a name identifying this string, and is only used for error messages.
.. method:: parse(string[, name]) .. method:: parse(string, name='<string>')
Divide the given string into examples and intervening text, and return them as Divide the given string into examples and intervening text, and return them as
a list of alternating :class:`Example`\ s and strings. Line numbers for the a list of alternating :class:`Example`\ s and strings. Line numbers for the
@ -1327,7 +1327,7 @@ DocTestRunner objects
^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^
.. class:: DocTestRunner([checker][, verbose][, optionflags]) .. class:: DocTestRunner(checker=None, verbose=None, optionflags=0)
A processing class used to execute and verify the interactive examples in a A processing class used to execute and verify the interactive examples in a
:class:`DocTest`. :class:`DocTest`.
@ -1409,7 +1409,7 @@ DocTestRunner objects
output function that was passed to :meth:`DocTestRunner.run`. output function that was passed to :meth:`DocTestRunner.run`.
.. method:: run(test[, compileflags][, out][, clear_globs]) .. method:: run(test, compileflags=None, out=None, clear_globs=True)
Run the examples in *test* (a :class:`DocTest` object), and display the Run the examples in *test* (a :class:`DocTest` object), and display the
results using the writer function *out*. results using the writer function *out*.
@ -1428,7 +1428,7 @@ DocTestRunner objects
:meth:`DocTestRunner.report_\*` methods. :meth:`DocTestRunner.report_\*` methods.
.. method:: summarize([verbose]) .. method:: summarize(verbose=None)
Print a summary of all the test cases that have been run by this DocTestRunner, Print a summary of all the test cases that have been run by this DocTestRunner,
and return a :term:`named tuple` ``TestResults(failed, attempted)``. and return a :term:`named tuple` ``TestResults(failed, attempted)``.
@ -1592,7 +1592,7 @@ code under the debugger:
converted to code, and the rest placed in comments. converted to code, and the rest placed in comments.
.. function:: debug(module, name[, pm]) .. function:: debug(module, name, pm=False)
Debug the doctests for an object. Debug the doctests for an object.
@ -1613,7 +1613,7 @@ code under the debugger:
passing an appropriate :func:`exec` call to :func:`pdb.run`. passing an appropriate :func:`exec` call to :func:`pdb.run`.
.. function:: debug_src(src[, pm][, globs]) .. function:: debug_src(src, pm=False, globs=None)
Debug the doctests in a string. Debug the doctests in a string.
@ -1633,7 +1633,7 @@ the source code, and especially :class:`DebugRunner`'s docstring (which is a
doctest!) for more details: doctest!) for more details:
.. class:: DebugRunner([checker][, verbose][, optionflags]) .. class:: DebugRunner(checker=None, verbose=None, optionflags=0)
A subclass of :class:`DocTestRunner` that raises an exception as soon as a A subclass of :class:`DocTestRunner` that raises an exception as soon as a
failure is encountered. If an unexpected exception occurs, an failure is encountered. If an unexpected exception occurs, an