Skip to content

Commit c2a4f4f

Browse files
committed
Update signature style for optional arguments, part 3.
1 parent 388faac commit c2a4f4f

File tree

14 files changed

+63
-70
lines changed

14 files changed

+63
-70
lines changed

Doc/library/codeop.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ of doing them both.
2626

2727
To do just the former:
2828

29-
.. function:: compile_command(source[, filename[, symbol]])
29+
.. function:: compile_command(source, filename="<input>", symbol="single")
3030

3131
Tries to compile *source*, which should be a string of Python code and return a
3232
code object if *source* is valid Python code. In that case, the filename

Doc/library/collections.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ counts, but the output will exclude results with counts of zero or less.
286286
:class:`deque` objects
287287
----------------------
288288

289-
.. class:: deque([iterable[, maxlen]])
289+
.. class:: deque([iterable, [maxlen]])
290290

291291
Returns a new deque object initialized left-to-right (using :meth:`append`) with
292292
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
605605
self-documenting code. They can be used wherever regular tuples are used, and
606606
they add the ability to access fields by name instead of position index.
607607

608-
.. function:: namedtuple(typename, field_names, [verbose], [rename])
608+
.. function:: namedtuple(typename, field_names, verbose=False, rename=False)
609609

610610
Returns a new tuple subclass named *typename*. The new subclass is used to
611611
create tuple-like objects that have fields accessible by attribute lookup as

Doc/library/compileall.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ sys.path``. Printing lists of the files compiled can be disabled with the
2020
expression argument. All files that match the expression will be skipped.
2121

2222

23-
.. function:: compile_dir(dir[, maxlevels[, ddir[, force[, rx[, quiet]]]]])
23+
.. function:: compile_dir(dir, maxlevels=10, ddir=None, force=False, rx=None, quiet=False)
2424

2525
Recursively descend the directory tree named by *dir*, compiling all :file:`.py`
2626
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.
3636
operation.
3737

3838

39-
.. function:: compile_path([skip_curdir[, maxlevels[, force]]])
39+
.. function:: compile_path(skip_curdir=True, maxlevels=0, force=False)
4040

4141
Byte-compile all the :file:`.py` files found along ``sys.path``. If
4242
*skip_curdir* is true (the default), the current directory is not included in

Doc/library/configparser.rst

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ dictionary type is passed that sorts its keys, the sections will be sorted on
5656
write-back, as will be the keys within each section.
5757

5858

59-
.. class:: RawConfigParser([defaults[, dict_type]])
59+
.. class:: RawConfigParser(defaults=None, dict_type=collections.OrderedDict)
6060

6161
The basic configuration object. When *defaults* is given, it is initialized
6262
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.
6868
The default *dict_type* is :class:`collections.OrderedDict`.
6969

7070

71-
.. class:: ConfigParser([defaults[, dict_type]])
71+
.. class:: ConfigParser(defaults=None, dict_type=collections.OrderedDict)
7272

7373
Derived class of :class:`RawConfigParser` that implements the magical
7474
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.
8787
The default *dict_type* is :class:`collections.OrderedDict`.
8888

8989

90-
.. class:: SafeConfigParser([defaults[, dict_type]])
90+
.. class:: SafeConfigParser(defaults=None, dict_type=collections.OrderedDict)
9191

9292
Derived class of :class:`ConfigParser` that implements a more-sane variant of
9393
the magical interpolation feature. This implementation is more predictable as
@@ -228,7 +228,7 @@ RawConfigParser Objects
228228
config.read(['site.cfg', os.path.expanduser('~/.myapp.cfg')])
229229

230230

231-
.. method:: RawConfigParser.readfp(fp[, filename])
231+
.. method:: RawConfigParser.readfp(fp, filename=None)
232232

233233
Read and parse configuration data from the file or file-like object in *fp*
234234
(only the :meth:`readline` method is used). If *filename* is omitted and *fp*
@@ -315,15 +315,15 @@ The :class:`ConfigParser` class extends some methods of the
315315
:class:`RawConfigParser` interface, adding some optional arguments.
316316

317317

318-
.. method:: ConfigParser.get(section, option[, raw[, vars]])
318+
.. method:: ConfigParser.get(section, option, raw=False, vars=None)
319319

320320
Get an *option* value for the named *section*. All the ``'%'`` interpolations
321321
are expanded in the return values, based on the defaults passed into the
322322
constructor, as well as the options *vars* provided, unless the *raw* argument
323323
is true.
324324

325325

326-
.. method:: ConfigParser.items(section[, raw[, vars]])
326+
.. method:: ConfigParser.items(section, raw=False, vars=None)
327327

328328
Return a list of ``(name, value)`` pairs for each option in the given *section*.
329329
Optional arguments have the same meaning as for the :meth:`get` method.

Doc/library/constants.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,8 @@ if the :option:`-S` command-line option is given) adds several constants to the
6161
built-in namespace. They are useful for the interactive interpreter shell and
6262
should not be used in programs.
6363

64-
.. data:: quit([code=None])
65-
exit([code=None])
64+
.. data:: quit(code=None)
65+
exit(code=None)
6666

6767
Objects that when printed, print a message like "Use quit() or Ctrl-D
6868
(i.e. EOF) to exit", and when called, raise :exc:`SystemExit` with the

Doc/library/copyreg.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ instances.
2424
hence not valid as a constructor), raises :exc:`TypeError`.
2525

2626

27-
.. function:: pickle(type, function[, constructor])
27+
.. function:: pickle(type, function, constructor=None)
2828

2929
Declares that *function* should be used as a "reduction" function for objects
3030
of type *type*. *function* should return either a string or a tuple

Doc/library/csv.rst

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ Module Contents
4747
The :mod:`csv` module defines the following functions:
4848

4949

50-
.. function:: reader(csvfile[, dialect='excel'][, fmtparam])
50+
.. function:: reader(csvfile, dialect='excel', **fmtparams)
5151

5252
Return a reader object which will iterate over lines in the given *csvfile*.
5353
*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:
5757
*dialect* parameter can be given which is used to define a set of parameters
5858
specific to a particular CSV dialect. It may be an instance of a subclass of
5959
the :class:`Dialect` class or one of the strings returned by the
60-
:func:`list_dialects` function. The other optional *fmtparam* keyword arguments
60+
:func:`list_dialects` function. The other optional *fmtparams* keyword arguments
6161
can be given to override individual formatting parameters in the current
6262
dialect. For full details about the dialect and formatting parameters, see
6363
section :ref:`csv-fmt-params`.
@@ -76,15 +76,15 @@ The :mod:`csv` module defines the following functions:
7676
Spam, Lovely Spam, Wonderful Spam
7777

7878

79-
.. function:: writer(csvfile[, dialect='excel'][, fmtparam])
79+
.. function:: writer(csvfile, dialect='excel', **fmtparams)
8080

8181
Return a writer object responsible for converting the user's data into delimited
8282
strings on the given file-like object. *csvfile* can be any object with a
8383
:func:`write` method. An optional *dialect*
8484
parameter can be given which is used to define a set of parameters specific to a
8585
particular CSV dialect. It may be an instance of a subclass of the
8686
:class:`Dialect` class or one of the strings returned by the
87-
:func:`list_dialects` function. The other optional *fmtparam* keyword arguments
87+
:func:`list_dialects` function. The other optional *fmtparams* keyword arguments
8888
can be given to override individual formatting parameters in the current
8989
dialect. For full details about the dialect and formatting parameters, see
9090
section :ref:`csv-fmt-params`. To make it
@@ -103,11 +103,11 @@ The :mod:`csv` module defines the following functions:
103103
>>> spamWriter.writerow(['Spam', 'Lovely Spam', 'Wonderful Spam'])
104104

105105

106-
.. function:: register_dialect(name[, dialect][, fmtparam])
106+
.. function:: register_dialect(name[, dialect], **fmtparams)
107107

108108
Associate *dialect* with *name*. *name* must be a string. The
109109
dialect can be specified either by passing a sub-class of :class:`Dialect`, or
110-
by *fmtparam* keyword arguments, or both, with keyword arguments overriding
110+
by *fmtparams* keyword arguments, or both, with keyword arguments overriding
111111
parameters of the dialect. For full details about the dialect and formatting
112112
parameters, see section :ref:`csv-fmt-params`.
113113

@@ -137,7 +137,7 @@ The :mod:`csv` module defines the following functions:
137137

138138
The :mod:`csv` module defines the following classes:
139139

140-
.. class:: DictReader(csvfile[, fieldnames=None[, restkey=None[, restval=None[, dialect='excel'[, *args, **kwds]]]]])
140+
.. class:: DictReader(csvfile, fieldnames=None, restkey=None, restval=None, dialect='excel', *args, **kwds)
141141

142142
Create an object which operates like a regular reader but maps the information
143143
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:
151151
arguments are passed to the underlying :class:`reader` instance.
152152

153153

154-
.. class:: DictWriter(csvfile, fieldnames[, restval=''[, extrasaction='raise'[, dialect='excel'[, *args, **kwds]]]])
154+
.. class:: DictWriter(csvfile, fieldnames, restval='', extrasaction='raise', dialect='excel', *args, **kwds)
155155

156156
Create an object which operates like a regular writer but maps dictionaries onto
157157
output rows. The *fieldnames* parameter identifies the order in which values in
@@ -195,7 +195,7 @@ The :mod:`csv` module defines the following classes:
195195

196196
The :class:`Sniffer` class provides two methods:
197197

198-
.. method:: sniff(sample[, delimiters=None])
198+
.. method:: sniff(sample, delimiters=None)
199199

200200
Analyze the given *sample* and return a :class:`Dialect` subclass
201201
reflecting the parameters found. If the optional *delimiters* parameter

Doc/library/curses.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -531,7 +531,7 @@ The module :mod:`curses` defines the following functions:
531531
capability, or is canceled or absent from the terminal description.
532532

533533

534-
.. function:: tparm(str[,...])
534+
.. function:: tparm(str[, ...])
535535

536536
Instantiates the string *str* with the supplied parameters, where *str* should
537537
be a parameterized string obtained from the terminfo database. E.g.

Doc/library/datetime.rst

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ A :class:`timedelta` object represents a duration, the difference between two
128128
dates or times.
129129

130130

131-
.. class:: timedelta([days[, seconds[, microseconds[, milliseconds[, minutes[, hours[, weeks]]]]]]])
131+
.. class:: timedelta(days=0, seconds=0, microseconds=0, milliseconds=0, minutes=0, hours=0, weeks=0)
132132

133133
All arguments are optional and default to ``0``. Arguments may be integers
134134
or floats, and may be positive or negative.
@@ -570,7 +570,7 @@ both directions; like a time object, :class:`datetime` assumes there are exactly
570570
Constructor:
571571

572572

573-
.. class:: datetime(year, month, day[, hour[, minute[, second[, microsecond[, tzinfo]]]]])
573+
.. class:: datetime(year, month, day, hour=0, minute=0, second=0, microsecond=0, tzinfo=None)
574574

575575
The year, month and day arguments are required. *tzinfo* may be ``None``, or an
576576
instance of a :class:`tzinfo` subclass. The remaining arguments may be integers,
@@ -596,7 +596,7 @@ Other constructors, all class methods:
596596
:meth:`fromtimestamp`.
597597

598598

599-
.. method:: datetime.now([tz])
599+
.. method:: datetime.now(tz=None)
600600

601601
Return the current local date and time. If optional argument *tz* is ``None``
602602
or not specified, this is like :meth:`today`, but, if possible, supplies more
@@ -617,7 +617,7 @@ Other constructors, all class methods:
617617
:class:`datetime` object. See also :meth:`now`.
618618

619619

620-
.. method:: datetime.fromtimestamp(timestamp[, tz])
620+
.. method:: datetime.fromtimestamp(timestamp, tz=None)
621621

622622
Return the local date and time corresponding to the POSIX timestamp, such as is
623623
returned by :func:`time.time`. If optional argument *tz* is ``None`` or not
@@ -947,7 +947,7 @@ Instance methods:
947947
``self.date().isocalendar()``.
948948

949949

950-
.. method:: datetime.isoformat([sep])
950+
.. method:: datetime.isoformat(sep='T')
951951

952952
Return a string representing the date and time in ISO 8601 format,
953953
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
11011101
day, and subject to adjustment via a :class:`tzinfo` object.
11021102

11031103

1104-
.. class:: time(hour[, minute[, second[, microsecond[, tzinfo]]]])
1104+
.. class:: time(hour=0, minute=0, second=0, microsecond=0, tzinfo=None)
11051105

11061106
All arguments are optional. *tzinfo* may be ``None``, or an instance of a
11071107
:class:`tzinfo` subclass. The remaining arguments may be integers, in the

Doc/library/dbm.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
name, such as ``'dbm.ndbm'`` or ``'dbm.gnu'``.
3131

3232

33-
.. function:: open(filename[, flag[, mode]])
33+
.. function:: open(filename, flag='r', mode=0o666)
3434

3535
Open the database file *filename* and return a corresponding object.
3636

@@ -121,7 +121,7 @@ supported.
121121
raised for general mapping errors like specifying an incorrect key.
122122

123123

124-
.. function:: open(filename, [flag, [mode]])
124+
.. function:: open(filename[, flag[, mode]])
125125

126126
Open a ``gdbm`` database and return a :class:`gdbm` object. The *filename*
127127
argument is the name of the database file.

0 commit comments

Comments
 (0)