Skip to content

Commit 1824415

Browse files
committed
Switch more function arguments docs to new-style.
1 parent 0bb1cc7 commit 1824415

39 files changed

+134
-160
lines changed

Doc/library/os.path.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ applications should use string objects to access all files.
218218
links encountered in the path (if they are supported by the operating system).
219219

220220

221-
.. function:: relpath(path[, start])
221+
.. function:: relpath(path, start=None)
222222

223223
Return a relative filepath to *path* either from the current directory or from
224224
an optional *start* point.

Doc/library/os.rst

+14-16
Original file line numberDiff line numberDiff line change
@@ -204,18 +204,17 @@ process and user.
204204
Return the current process's user id. Availability: Unix.
205205

206206

207-
.. function:: getenv(varname[, value])
207+
.. function:: getenv(key, default=None)
208208

209-
Return the value of the environment variable *varname* if it exists, or *value*
210-
if it doesn't. *value* defaults to ``None``. Availability: most flavors of
211-
Unix, Windows.
209+
Return the value of the environment variable *key* if it exists, or
210+
*default* if it doesn't. Availability: most flavors of Unix, Windows.
212211

213212

214-
.. function:: putenv(varname, value)
213+
.. function:: putenv(key, value)
215214

216215
.. index:: single: environment variables; setting
217216

218-
Set the environment variable named *varname* to the string *value*. Such
217+
Set the environment variable named *key* to the string *value*. Such
219218
changes to the environment affect subprocesses started with :func:`os.system`,
220219
:func:`popen` or :func:`fork` and :func:`execv`. Availability: most flavors of
221220
Unix, Windows.
@@ -326,11 +325,11 @@ process and user.
326325
Unix.
327326

328327

329-
.. function:: unsetenv(varname)
328+
.. function:: unsetenv(key)
330329

331330
.. index:: single: environment variables; deleting
332331

333-
Unset (delete) the environment variable named *varname*. Such changes to the
332+
Unset (delete) the environment variable named *key*. Such changes to the
334333
environment affect subprocesses started with :func:`os.system`, :func:`popen` or
335334
:func:`fork` and :func:`execv`. Availability: most flavors of Unix, Windows.
336335

@@ -847,15 +846,14 @@ Files and Directories
847846
doesn't open the FIFO --- it just creates the rendezvous point.
848847

849848

850-
.. function:: mknod(filename[, mode=0o600, device])
849+
.. function:: mknod(filename[, mode=0o600[, device]])
851850

852851
Create a filesystem node (file, device special file or named pipe) named
853-
*filename*. *mode* specifies both the permissions to use and the type of node to
854-
be created, being combined (bitwise OR) with one of ``stat.S_IFREG``,
855-
``stat.S_IFCHR``, ``stat.S_IFBLK``,
856-
and ``stat.S_IFIFO`` (those constants are available in :mod:`stat`).
857-
For ``stat.S_IFCHR`` and
858-
``stat.S_IFBLK``, *device* defines the newly created device special file (probably using
852+
*filename*. *mode* specifies both the permissions to use and the type of node
853+
to be created, being combined (bitwise OR) with one of ``stat.S_IFREG``,
854+
``stat.S_IFCHR``, ``stat.S_IFBLK``, and ``stat.S_IFIFO`` (those constants are
855+
available in :mod:`stat`). For ``stat.S_IFCHR`` and ``stat.S_IFBLK``,
856+
*device* defines the newly created device special file (probably using
859857
:func:`os.makedev`), otherwise it is ignored.
860858

861859

@@ -1123,7 +1121,7 @@ Files and Directories
11231121
Availability: Unix, Windows.
11241122

11251123

1126-
.. function:: walk(top[, topdown=True [, onerror=None[, followlinks=False]]])
1124+
.. function:: walk(top, topdown=True, onerror=None, followlinks=False)
11271125

11281126
.. index::
11291127
single: directory; walking

Doc/library/ossaudiodev.rst

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
:mod:`ossaudiodev` --- Access to OSS-compatible audio devices
32
=============================================================
43

Doc/library/parser.rst

+8-9
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
:mod:`parser` --- Access Python parse trees
32
===========================================
43

@@ -165,7 +164,7 @@ executable code objects. Parse trees may be extracted with or without line
165164
numbering information.
166165

167166

168-
.. function:: st2list(st[, line_info])
167+
.. function:: st2list(st, line_info=False, col_info=False)
169168

170169
This function accepts an ST object from the caller in *st* and returns a
171170
Python list representing the equivalent parse tree. The resulting list
@@ -183,7 +182,7 @@ numbering information.
183182
This information is omitted if the flag is false or omitted.
184183

185184

186-
.. function:: st2tuple(st[, line_info])
185+
.. function:: st2tuple(st, line_info=False, col_info=False)
187186

188187
This function accepts an ST object from the caller in *st* and returns a
189188
Python tuple representing the equivalent parse tree. Other than returning a
@@ -194,7 +193,7 @@ numbering information.
194193
information is omitted if the flag is false or omitted.
195194

196195

197-
.. function:: compilest(st[, filename='<syntax-tree>'])
196+
.. function:: compilest(st, filename='<syntax-tree>')
198197

199198
.. index::
200199
builtin: exec
@@ -293,7 +292,7 @@ ST objects (using the :mod:`pickle` module) is also supported.
293292
ST objects have the following methods:
294293

295294

296-
.. method:: ST.compile([filename])
295+
.. method:: ST.compile(filename='<syntax-tree>')
297296

298297
Same as ``compilest(st, filename)``.
299298

@@ -308,14 +307,14 @@ ST objects have the following methods:
308307
Same as ``issuite(st)``.
309308

310309

311-
.. method:: ST.tolist([line_info])
310+
.. method:: ST.tolist(line_info=False, col_info=False)
312311

313-
Same as ``st2list(st, line_info)``.
312+
Same as ``st2list(st, line_info, col_info)``.
314313

315314

316-
.. method:: ST.totuple([line_info])
315+
.. method:: ST.totuple(line_info=False, col_info=False)
317316

318-
Same as ``st2tuple(st, line_info)``.
317+
Same as ``st2tuple(st, line_info, col_info)``.
319318

320319

321320
.. _st-examples:

Doc/library/pdb.rst

+7-7
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ The typical usage to inspect a crashed program is::
7979
The module defines the following functions; each enters the debugger in a
8080
slightly different way:
8181

82-
.. function:: run(statement[, globals[, locals]])
82+
.. function:: run(statement, globals=None, locals=None)
8383

8484
Execute the *statement* (given as a string) under debugger control. The
8585
debugger prompt appears before any code is executed; you can set breakpoints and
@@ -90,14 +90,14 @@ slightly different way:
9090
explanation of the built-in :func:`exec` or :func:`eval` functions.)
9191

9292

93-
.. function:: runeval(expression[, globals[, locals]])
93+
.. function:: runeval(expression, globals=None, locals=None)
9494

9595
Evaluate the *expression* (given as a string) under debugger control. When
9696
:func:`runeval` returns, it returns the value of the expression. Otherwise this
9797
function is similar to :func:`run`.
9898

9999

100-
.. function:: runcall(function[, argument, ...])
100+
.. function:: runcall(function, *args, **kwds)
101101

102102
Call the *function* (a function or method object, not a string) with the given
103103
arguments. When :func:`runcall` returns, it returns whatever the function call
@@ -111,7 +111,7 @@ slightly different way:
111111
being debugged (e.g. when an assertion fails).
112112

113113

114-
.. function:: post_mortem([traceback])
114+
.. function:: post_mortem(traceback=None)
115115

116116
Enter post-mortem debugging of the given *traceback* object. If no
117117
*traceback* is given, it uses the one of the exception that is currently
@@ -147,9 +147,9 @@ access further features, you have to do this yourself:
147147
.. versionadded:: 3.1
148148
The *skip* argument.
149149

150-
.. method:: run(statement[, globals[, locals]])
151-
runeval(expression[, globals[, locals]])
152-
runcall(function[, argument, ...])
150+
.. method:: run(statement, globals=None, locals=None)
151+
runeval(expression, globals=None, locals=None)
152+
runcall(function, *args, **kwds)
153153
set_trace()
154154
155155
See the documentation for the functions explained above.

Doc/library/persistence.rst

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
.. _persistence:
32

43
****************

Doc/library/pickle.rst

+6-6
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ an unpickler, then you call the unpickler's :meth:`load` method. The
141141
The :mod:`pickle` module provides the following functions to make the pickling
142142
process more convenient:
143143

144-
.. function:: dump(obj, file[, protocol, \*, fix_imports=True])
144+
.. function:: dump(obj, file, protocol=None, \*, fix_imports=True)
145145

146146
Write a pickled representation of *obj* to the open file object *file*. This
147147
is equivalent to ``Pickler(file, protocol).dump(obj)``.
@@ -162,7 +162,7 @@ process more convenient:
162162
map the new Python 3.x names to the old module names used in Python 2.x,
163163
so that the pickle data stream is readable with Python 2.x.
164164

165-
.. function:: dumps(obj[, protocol, \*, fix_imports=True])
165+
.. function:: dumps(obj, protocol=None, \*, fix_imports=True)
166166

167167
Return the pickled representation of the object as a :class:`bytes`
168168
object, instead of writing it to a file.
@@ -179,7 +179,7 @@ process more convenient:
179179
map the new Python 3.x names to the old module names used in Python 2.x,
180180
so that the pickle data stream is readable with Python 2.x.
181181

182-
.. function:: load(file, [\*, fix_imports=True, encoding="ASCII", errors="strict"])
182+
.. function:: load(file, \*, fix_imports=True, encoding="ASCII", errors="strict")
183183

184184
Read a pickled object representation from the open file object *file* and
185185
return the reconstituted object hierarchy specified therein. This is
@@ -202,7 +202,7 @@ process more convenient:
202202
*errors* tell pickle how to decode 8-bit string instances pickled by Python
203203
2.x; these default to 'ASCII' and 'strict', respectively.
204204

205-
.. function:: loads(bytes_object, [\*, fix_imports=True, encoding="ASCII", errors="strict"])
205+
.. function:: loads(bytes_object, \*, fix_imports=True, encoding="ASCII", errors="strict")
206206

207207
Read a pickled object hierarchy from a :class:`bytes` object and return the
208208
reconstituted object hierarchy specified therein
@@ -247,7 +247,7 @@ The :mod:`pickle` module defines three exceptions:
247247
The :mod:`pickle` module exports two classes, :class:`Pickler` and
248248
:class:`Unpickler`:
249249

250-
.. class:: Pickler(file[, protocol, \*, fix_imports=True])
250+
.. class:: Pickler(file, protocol=None, \*, fix_imports=True)
251251

252252
This takes a binary file for writing a pickle data stream.
253253

@@ -295,7 +295,7 @@ The :mod:`pickle` module exports two classes, :class:`Pickler` and
295295
Use :func:`pickletools.optimize` if you need more compact pickles.
296296

297297

298-
.. class:: Unpickler(file, [\*, fix_imports=True, encoding="ASCII", errors="strict"])
298+
.. class:: Unpickler(file, \*, fix_imports=True, encoding="ASCII", errors="strict")
299299

300300
This takes a binary file for reading a pickle data stream.
301301

Doc/library/pickletools.rst

+3-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
==================================================
33

44
.. module:: pickletools
5-
:synopsis: Contains extensive comments about the pickle protocols and pickle-machine opcodes, as well as some useful functions.
5+
:synopsis: Contains extensive comments about the pickle protocols and
6+
pickle-machine opcodes, as well as some useful functions.
67

78
This module contains various constants relating to the intimate details of the
89
:mod:`pickle` module, some lengthy comments about the implementation, and a
@@ -12,7 +13,7 @@ ordinary users of the :mod:`pickle` module probably won't find the
1213
:mod:`pickletools` module relevant.
1314

1415

15-
.. function:: dis(pickle[, out=None, memo=None, indentlevel=4])
16+
.. function:: dis(pickle, out=None, memo=None, indentlevel=4)
1617

1718
Outputs a symbolic disassembly of the pickle to the file-like object *out*,
1819
defaulting to ``sys.stdout``. *pickle* can be a string or a file-like object.

Doc/library/pipes.rst

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
:mod:`pipes` --- Interface to shell pipelines
32
=============================================
43

Doc/library/pkgutil.rst

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
:mod:`pkgutil` --- Package extension utility
32
============================================
43

Doc/library/poplib.rst

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
:mod:`poplib` --- POP3 protocol client
32
======================================
43

@@ -24,7 +23,7 @@ mailserver supports IMAP, you would be better off using the
2423
A single class is provided by the :mod:`poplib` module:
2524

2625

27-
.. class:: POP3(host[, port[, timeout]])
26+
.. class:: POP3(host, port=POP3_PORT[, timeout])
2827

2928
This class implements the actual POP3 protocol. The connection is created when
3029
the instance is initialized. If *port* is omitted, the standard POP3 port (110)
@@ -33,12 +32,13 @@ A single class is provided by the :mod:`poplib` module:
3332
be used).
3433

3534

36-
.. class:: POP3_SSL(host[, port[, keyfile[, certfile]]])
35+
.. class:: POP3_SSL(host, port=POP3_SSL_PORT, keyfile=None, certfile=None[, timeout])
3736

3837
This is a subclass of :class:`POP3` that connects to the server over an SSL
3938
encrypted socket. If *port* is not specified, 995, the standard POP3-over-SSL
4039
port is used. *keyfile* and *certfile* are also optional - they can contain a
4140
PEM formatted private key and certificate chain file for the SSL connection.
41+
*timeout* works as in the :class:`POP3` constructor.
4242

4343

4444
One exception is defined as an attribute of the :mod:`poplib` module:
@@ -160,7 +160,7 @@ An :class:`POP3` instance has the following methods:
160160
POP3 servers you will use before trusting it.
161161

162162

163-
.. method:: POP3.uidl([which])
163+
.. method:: POP3.uidl(which=None)
164164

165165
Return message digest (unique id) list. If *which* is specified, result contains
166166
the unique id for that message in the form ``'response mesgnum uid``, otherwise

Doc/library/pprint.rst

+7-8
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
:mod:`pprint` --- Data pretty printer
32
=====================================
43

@@ -27,7 +26,7 @@ The :mod:`pprint` module defines one class:
2726
.. First the implementation class:
2827
2928
30-
.. class:: PrettyPrinter(...)
29+
.. class:: PrettyPrinter(indent=1, width=80, depth=None, stream=None)
3130

3231
Construct a :class:`PrettyPrinter` instance. This constructor understands
3332
several keyword parameters. An output stream may be set using the *stream*
@@ -62,21 +61,20 @@ The :mod:`pprint` module defines one class:
6261
>>> pp.pprint(tup)
6362
('spam', ('eggs', ('lumberjack', ('knights', ('ni', ('dead', (...)))))))
6463

65-
The :class:`PrettyPrinter` class supports several derivative functions:
6664

67-
.. Now the derivative functions:
65+
The :class:`PrettyPrinter` class supports several derivative functions:
6866

69-
.. function:: pformat(object[, indent[, width[, depth]]])
67+
.. function:: pformat(object, indent=1, width=80, depth=None)
7068

7169
Return the formatted representation of *object* as a string. *indent*, *width*
7270
and *depth* will be passed to the :class:`PrettyPrinter` constructor as
7371
formatting parameters.
7472

7573

76-
.. function:: pprint(object[, stream[, indent[, width[, depth]]]])
74+
.. function:: pprint(object, stream=None, indent=1, width=80, depth=None)
7775

7876
Prints the formatted representation of *object* on *stream*, followed by a
79-
newline. If *stream* is omitted, ``sys.stdout`` is used. This may be used
77+
newline. If *stream* is ``None``, ``sys.stdout`` is used. This may be used
8078
in the interactive interpreter instead of the :func:`print` function for
8179
inspecting values (you can even reassign ``print = pprint.pprint`` for use
8280
within a scope). *indent*, *width* and *depth* will be passed to the
@@ -191,7 +189,8 @@ are converted to strings. The default implementation uses the internals of the
191189
pprint Example
192190
--------------
193191

194-
This example demonstrates several uses of the :func:`pprint` function and its parameters.
192+
This example demonstrates several uses of the :func:`pprint` function and its
193+
parameters.
195194

196195
>>> import pprint
197196
>>> tup = ('spam', ('eggs', ('lumberjack', ('knights', ('ni', ('dead',

0 commit comments

Comments
 (0)