diff options
author | Georg Brandl <georg@python.org> | 2009-04-10 09:03:43 (GMT) |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2009-04-10 09:03:43 (GMT) |
commit | c2a4f4fb67a76cb04731beebc515878f9b91674c (patch) | |
tree | 35fe3ee01b0b32931f4beb11ebcc4553d0f34f3a | |
parent | 388faac8cb5be6ad1ad474bae237b71bd00a1900 (diff) | |
download | cpython-c2a4f4fb67a76cb04731beebc515878f9b91674c.zip cpython-c2a4f4fb67a76cb04731beebc515878f9b91674c.tar.gz cpython-c2a4f4fb67a76cb04731beebc515878f9b91674c.tar.bz2 |
Update signature style for optional arguments, part 3.
-rw-r--r-- | Doc/library/codeop.rst | 2 | ||||
-rw-r--r-- | Doc/library/collections.rst | 4 | ||||
-rw-r--r-- | Doc/library/compileall.rst | 4 | ||||
-rw-r--r-- | Doc/library/configparser.rst | 12 | ||||
-rw-r--r-- | Doc/library/constants.rst | 4 | ||||
-rw-r--r-- | Doc/library/copyreg.rst | 2 | ||||
-rw-r--r-- | Doc/library/csv.rst | 18 | ||||
-rw-r--r-- | Doc/library/curses.rst | 2 | ||||
-rw-r--r-- | Doc/library/datetime.rst | 12 | ||||
-rw-r--r-- | Doc/library/dbm.rst | 4 | ||||
-rw-r--r-- | Doc/library/decimal.rst | 2 | ||||
-rw-r--r-- | Doc/library/difflib.rst | 22 | ||||
-rw-r--r-- | Doc/library/dis.rst | 15 | ||||
-rw-r--r-- | Doc/library/doctest.rst | 30 |
14 files changed, 63 insertions, 70 deletions
diff --git a/Doc/library/codeop.rst b/Doc/library/codeop.rst index e4523b6..2c066ef 100644 --- a/Doc/library/codeop.rst +++ b/Doc/library/codeop.rst @@ -26,7 +26,7 @@ of doing them both. 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 code object if *source* is valid Python code. In that case, the filename diff --git a/Doc/library/collections.rst b/Doc/library/collections.rst index e27d89a..c334dc7 100644 --- a/Doc/library/collections.rst +++ b/Doc/library/collections.rst @@ -286,7 +286,7 @@ counts, but the output will exclude results with counts of zero or less. :class:`deque` objects ---------------------- -.. class:: deque([iterable[, maxlen]]) +.. class:: deque([iterable, [maxlen]]) 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. @@ -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 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 create tuple-like objects that have fields accessible by attribute lookup as diff --git a/Doc/library/compileall.rst b/Doc/library/compileall.rst index 86f60fb..52f881b 100644 --- a/Doc/library/compileall.rst +++ b/Doc/library/compileall.rst @@ -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. -.. 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` 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. -.. 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 *skip_curdir* is true (the default), the current directory is not included in diff --git a/Doc/library/configparser.rst b/Doc/library/configparser.rst index 6141359..0c8ff65 100644 --- a/Doc/library/configparser.rst +++ b/Doc/library/configparser.rst @@ -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. -.. class:: RawConfigParser([defaults[, dict_type]]) +.. class:: RawConfigParser(defaults=None, dict_type=collections.OrderedDict) The basic configuration object. When *defaults* is given, it is initialized 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`. -.. class:: ConfigParser([defaults[, dict_type]]) +.. class:: ConfigParser(defaults=None, dict_type=collections.OrderedDict) Derived class of :class:`RawConfigParser` that implements the magical 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`. -.. 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 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')]) -.. 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* (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. -.. 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 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. -.. 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*. Optional arguments have the same meaning as for the :meth:`get` method. diff --git a/Doc/library/constants.rst b/Doc/library/constants.rst index 39d61cb..b9b3671 100644 --- a/Doc/library/constants.rst +++ b/Doc/library/constants.rst @@ -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 should not be used in programs. -.. data:: quit([code=None]) - exit([code=None]) +.. data:: quit(code=None) + exit(code=None) 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 diff --git a/Doc/library/copyreg.rst b/Doc/library/copyreg.rst index dd97ade..60df3d0 100644 --- a/Doc/library/copyreg.rst +++ b/Doc/library/copyreg.rst @@ -24,7 +24,7 @@ instances. 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 of type *type*. *function* should return either a string or a tuple diff --git a/Doc/library/csv.rst b/Doc/library/csv.rst index fd56e46..87ed3b6 100644 --- a/Doc/library/csv.rst +++ b/Doc/library/csv.rst @@ -47,7 +47,7 @@ Module Contents 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*. *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 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 - :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 dialect. For full details about the dialect and formatting parameters, see section :ref:`csv-fmt-params`. @@ -76,7 +76,7 @@ The :mod:`csv` module defines the following functions: 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 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 particular CSV dialect. It may be an instance of a subclass of 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 dialect. For full details about the dialect and formatting parameters, see 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']) -.. function:: register_dialect(name[, dialect][, fmtparam]) +.. function:: register_dialect(name[, dialect], **fmtparams) Associate *dialect* with *name*. *name* must be a string. The 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, 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: -.. 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. @@ -151,7 +151,7 @@ The :mod:`csv` module defines the following classes: 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 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: - .. 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 diff --git a/Doc/library/curses.rst b/Doc/library/curses.rst index 21c3176..b16d667 100644 --- a/Doc/library/curses.rst +++ b/Doc/library/curses.rst @@ -531,7 +531,7 @@ The module :mod:`curses` defines the following functions: 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 be a parameterized string obtained from the terminfo database. E.g. diff --git a/Doc/library/datetime.rst b/Doc/library/datetime.rst index 0bf3eb7..df04cf3 100644 --- a/Doc/library/datetime.rst +++ b/Doc/library/datetime.rst @@ -128,7 +128,7 @@ A :class:`timedelta` object represents a duration, the difference between two 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 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: -.. 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 instance of a :class:`tzinfo` subclass. The remaining arguments may be integers, @@ -596,7 +596,7 @@ Other constructors, all class methods: :meth:`fromtimestamp`. -.. method:: datetime.now([tz]) +.. method:: datetime.now(tz=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 @@ -617,7 +617,7 @@ Other constructors, all class methods: :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 returned by :func:`time.time`. If optional argument *tz* is ``None`` or not @@ -947,7 +947,7 @@ Instance methods: ``self.date().isocalendar()``. -.. method:: datetime.isoformat([sep]) +.. method:: datetime.isoformat(sep='T') Return a string representing the date and time in ISO 8601 format, 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. -.. 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 :class:`tzinfo` subclass. The remaining arguments may be integers, in the diff --git a/Doc/library/dbm.rst b/Doc/library/dbm.rst index 84edbbe..0fa0eb2 100644 --- a/Doc/library/dbm.rst +++ b/Doc/library/dbm.rst @@ -30,7 +30,7 @@ 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. @@ -121,7 +121,7 @@ supported. 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* argument is the name of the database file. diff --git a/Doc/library/decimal.rst b/Doc/library/decimal.rst index 350413f..89acbb8 100644 --- a/Doc/library/decimal.rst +++ b/Doc/library/decimal.rst @@ -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*. diff --git a/Doc/library/difflib.rst b/Doc/library/difflib.rst index 00f273e..292c0ce 100644 --- a/Doc/library/difflib.rst +++ b/Doc/library/difflib.rst @@ -72,7 +72,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]) + .. method:: __init__(tabsize=8, wrapcolumn=None, linejunk=None, charjunk=IS_CHARACTER_JUNK) 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: - - .. function:: make_file(fromlines, tolines [, fromdesc][, todesc][, context][, numlines]) + .. method:: make_file(fromlines, tolines, fromdesc='', todesc='', context=False, numlines=5) 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 @@ -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 context). - - .. function:: make_table(fromlines, tolines [, fromdesc][, todesc][, context][, numlines]) + .. method:: make_table(fromlines, tolines, fromdesc='', todesc='', context=False, numlines=5) 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 @@ -122,7 +120,7 @@ diffs. For comparing directories and files, see also, the :mod:`filecmp` module. 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` 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. -.. 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 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'] -.. 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 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 -.. 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` generating the delta lines) in unified diff format. @@ -326,7 +324,7 @@ SequenceMatcher Objects 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 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) - .. method:: get_grouped_opcodes([n]) + .. method:: get_grouped_opcodes(n=3) 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: -.. class:: Differ([linejunk[, charjunk]]) +.. class:: Differ(linejunk=None, charjunk=None) Optional keyword parameters *linejunk* and *charjunk* are for filter functions (or ``None``): diff --git a/Doc/library/dis.rst b/Doc/library/dis.rst index 856a9e4..c5a7ea8 100644 --- a/Doc/library/dis.rst +++ b/Doc/library/dis.rst @@ -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: -.. 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 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 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 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 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. -.. 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) This generator function uses the ``co_firstlineno`` and ``co_lnotab`` diff --git a/Doc/library/doctest.rst b/Doc/library/doctest.rst index c991495..2d0f48a 100644 --- a/Doc/library/doctest.rst +++ b/Doc/library/doctest.rst @@ -753,7 +753,7 @@ introduction to these two functions, see sections :ref:`doctest-simple-testmod` 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 form. @@ -822,7 +822,7 @@ and :ref:`doctest-simple-testfile`. 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 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: -.. 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, 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: -.. 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 :class:`unittest.TestSuite`. @@ -972,7 +972,7 @@ from text files and modules with doctests: 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`. @@ -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 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 given object, from its docstring and the docstrings of its contained objects. @@ -1306,14 +1306,14 @@ DocTestParser objects 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 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. - .. method:: parse(string[, name]) + .. method:: parse(string, name='<string>') 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 @@ -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 :class:`DocTest`. @@ -1409,7 +1409,7 @@ DocTestRunner objects 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 results using the writer function *out*. @@ -1428,7 +1428,7 @@ DocTestRunner objects :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, 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. -.. function:: debug(module, name[, pm]) +.. function:: debug(module, name, pm=False) Debug the doctests for an object. @@ -1613,7 +1613,7 @@ code under the debugger: 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. @@ -1633,7 +1633,7 @@ the source code, and especially :class:`DebugRunner`'s docstring (which is a 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 failure is encountered. If an unexpected exception occurs, an |