Skip to content

Commit 2d6097d

Browse files
csabellabirkenfeld
authored andcommitted
bpo-11233: Create availability directive for documentation (GH-9692)
Replace "Availability: xxx" with ".. availability:: xxx" in the doc. Original patch by Georg Brandl. Co-Authored-By: Georg Brandl <[email protected]>
1 parent da2bf9f commit 2d6097d

27 files changed

+351
-291
lines changed

Doc/c-api/exceptions.rst

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -186,42 +186,52 @@ NULL pointer for use in a ``return`` statement.
186186
then it constructs a tuple object whose first item is the *ierr* value and whose
187187
second item is the corresponding error message (gotten from
188188
:c:func:`FormatMessage`), and then calls ``PyErr_SetObject(PyExc_WindowsError,
189-
object)``. This function always returns *NULL*. Availability: Windows.
189+
object)``. This function always returns *NULL*.
190+
191+
.. availability:: Windows.
190192
191193
192194
.. c:function:: PyObject* PyErr_SetExcFromWindowsErr(PyObject *type, int ierr)
193195
194196
Similar to :c:func:`PyErr_SetFromWindowsErr`, with an additional parameter
195-
specifying the exception type to be raised. Availability: Windows.
197+
specifying the exception type to be raised.
198+
199+
.. availability:: Windows.
196200
197201
198202
.. c:function:: PyObject* PyErr_SetFromWindowsErrWithFilename(int ierr, const char *filename)
199203
200204
Similar to :c:func:`PyErr_SetFromWindowsErrWithFilenameObject`, but the
201205
filename is given as a C string. *filename* is decoded from the filesystem
202-
encoding (:func:`os.fsdecode`). Availability: Windows.
206+
encoding (:func:`os.fsdecode`).
207+
208+
.. availability:: Windows.
203209
204210
205211
.. c:function:: PyObject* PyErr_SetExcFromWindowsErrWithFilenameObject(PyObject *type, int ierr, PyObject *filename)
206212
207213
Similar to :c:func:`PyErr_SetFromWindowsErrWithFilenameObject`, with an
208214
additional parameter specifying the exception type to be raised.
209-
Availability: Windows.
215+
216+
.. availability:: Windows.
210217
211218
212219
.. c:function:: PyObject* PyErr_SetExcFromWindowsErrWithFilenameObjects(PyObject *type, int ierr, PyObject *filename, PyObject *filename2)
213220
214221
Similar to :c:func:`PyErr_SetExcFromWindowsErrWithFilenameObject`,
215222
but accepts a second filename object.
216-
Availability: Windows.
223+
224+
.. availability:: Windows.
217225
218226
.. versionadded:: 3.4
219227
220228
221229
.. c:function:: PyObject* PyErr_SetExcFromWindowsErrWithFilename(PyObject *type, int ierr, const char *filename)
222230
223231
Similar to :c:func:`PyErr_SetFromWindowsErrWithFilename`, with an additional
224-
parameter specifying the exception type to be raised. Availability: Windows.
232+
parameter specifying the exception type to be raised.
233+
234+
.. availability:: Windows.
225235
226236
227237
.. c:function:: PyObject* PyErr_SetImportError(PyObject *msg, PyObject *name, PyObject *path)

Doc/c-api/init.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ to 1 and ``-bb`` sets :c:data:`Py_BytesWarningFlag` to 2.
156156

157157
See :pep:`529` for more details.
158158

159-
Availability: Windows.
159+
.. availability:: Windows.
160160

161161
.. c:var:: Py_LegacyWindowsStdioFlag
162162
@@ -168,7 +168,7 @@ to 1 and ``-bb`` sets :c:data:`Py_BytesWarningFlag` to 2.
168168

169169
See :pep:`528` for more details.
170170

171-
Availability: Windows.
171+
.. availability:: Windows.
172172

173173
.. c:var:: Py_NoSiteFlag
174174

Doc/library/_thread.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,8 @@ This module defines the following constants and functions:
101101
memory page size - platform documentation should be referred to for more
102102
information (4 KiB pages are common; using multiples of 4096 for the stack size is
103103
the suggested approach in the absence of more specific information).
104-
Availability: Windows, systems with POSIX threads.
104+
105+
.. availability:: Windows, systems with POSIX threads.
105106

106107

107108
.. data:: TIMEOUT_MAX

Doc/library/asyncio-eventloop.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -510,7 +510,7 @@ Opening network connections
510510
See the documentation of the :meth:`loop.create_connection` method
511511
for information about arguments to this method.
512512

513-
Availability: Unix.
513+
.. availability:: Unix.
514514

515515
.. versionadded:: 3.7
516516

@@ -630,7 +630,7 @@ Creating network servers
630630
See the documentation of the :meth:`loop.create_server` method
631631
for information about arguments to this method.
632632

633-
Availability: Unix.
633+
.. availability:: Unix.
634634

635635
.. versionadded:: 3.7
636636

@@ -979,7 +979,7 @@ Unix signals
979979
Return ``True`` if the signal handler was removed, or ``False`` if
980980
no handler was set for the given signal.
981981

982-
Availability: Unix.
982+
.. availability:: Unix.
983983

984984
.. seealso::
985985

@@ -1423,14 +1423,14 @@ on all platforms.
14231423
asyncio.set_event_loop(loop)
14241424

14251425

1426-
Availability: Unix, Windows.
1426+
.. availability:: Unix, Windows.
14271427

14281428

14291429
.. class:: ProactorEventLoop
14301430

14311431
An event loop for Windows that uses "I/O Completion Ports" (IOCP).
14321432

1433-
Availability: Windows.
1433+
.. availability:: Windows.
14341434

14351435
.. seealso::
14361436

Doc/library/asyncio-policy.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,15 +107,15 @@ asyncio ships with the following built-in policies:
107107
An alternative event loop policy that uses the
108108
:class:`SelectorEventLoop` event loop implementation.
109109

110-
Availability: Windows.
110+
.. availability:: Windows.
111111

112112

113113
.. class:: WindowsProactorEventLoopPolicy
114114

115115
An alternative event loop policy that uses the
116116
:class:`ProactorEventLoop` event loop implementation.
117117

118-
Availability: Windows.
118+
.. availability:: Windows.
119119

120120

121121
Process Watchers

Doc/library/asyncio-stream.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ and work with streams:
114114

115115
See also the documentation of :meth:`loop.create_unix_connection`.
116116

117-
Availability: Unix.
117+
.. availability:: Unix.
118118

119119
.. versionadded:: 3.7
120120

@@ -136,7 +136,7 @@ and work with streams:
136136

137137
See also the documentation of :meth:`loop.create_unix_server`.
138138

139-
Availability: Unix.
139+
.. availability:: Unix.
140140

141141
.. versionadded:: 3.7
142142

Doc/library/asyncore.rst

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -273,14 +273,18 @@ any that have been added to the map during asynchronous service) is closed.
273273
with an optional map argument and wraps it for use with the :c:func:`poll`
274274
or :c:func:`loop` functions. If provided a file object or anything with a
275275
:c:func:`fileno` method, that method will be called and passed to the
276-
:class:`file_wrapper` constructor. Availability: UNIX.
276+
:class:`file_wrapper` constructor.
277+
278+
.. availability:: Unix.
277279

278280
.. class:: file_wrapper()
279281

280282
A file_wrapper takes an integer file descriptor and calls :func:`os.dup` to
281283
duplicate the handle so that the original handle may be closed independently
282284
of the file_wrapper. This class implements sufficient methods to emulate a
283-
socket for use by the :class:`file_dispatcher` class. Availability: UNIX.
285+
socket for use by the :class:`file_dispatcher` class.
286+
287+
.. availability:: Unix.
284288

285289

286290
.. _asyncore-example-1:

Doc/library/codecs.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1471,7 +1471,7 @@ functions can be used directly if desired.
14711471

14721472
Encode operand according to the ANSI codepage (CP_ACP).
14731473

1474-
Availability: Windows only.
1474+
.. availability:: Windows only.
14751475

14761476
.. versionchanged:: 3.3
14771477
Support any error handler.

Doc/library/hashlib.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ include a `salt <https://en.wikipedia.org/wiki/Salt_%28cryptography%29>`_.
271271
factor and *maxmem* limits memory (OpenSSL 1.1.0 defaults to 32 MiB).
272272
*dklen* is the length of the derived key.
273273

274-
Availability: OpenSSL 1.1+
274+
.. availability:: OpenSSL 1.1+.
275275

276276
.. versionadded:: 3.6
277277

Doc/library/intro.rst

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,3 +47,16 @@ this material.
4747

4848
Let the show begin!
4949

50+
51+
.. _availability:
52+
53+
Notes on availability
54+
=====================
55+
56+
* An "Availability: Unix" note means that this function is commonly found on
57+
Unix systems. It does not make any claims about its existence on a specific
58+
operating system.
59+
60+
* If not separately noted, all functions that claim "Availability: Unix" are
61+
supported on Mac OS X, which builds on a Unix core.
62+

Doc/library/mimetypes.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,9 @@ than one MIME-type database; it provides an interface similar to the one of the
260260

261261
.. method:: MimeTypes.read_windows_registry(strict=True)
262262

263-
Load MIME type information from the Windows registry. Availability: Windows.
263+
Load MIME type information from the Windows registry.
264+
265+
.. availability:: Windows.
264266

265267
If *strict* is ``True``, information will be added to the list of standard
266268
types, else to the list of non-standard types.

Doc/library/os.path.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ the :mod:`glob` module.)
9393
pathnames, or if *paths* is empty. Unlike :func:`commonprefix`, this
9494
returns a valid path.
9595

96-
Availability: Unix, Windows
96+
.. availability:: Unix, Windows.
9797

9898
.. versionadded:: 3.5
9999

@@ -357,7 +357,7 @@ the :mod:`glob` module.)
357357

358358
*start* defaults to :attr:`os.curdir`.
359359

360-
Availability: Unix, Windows.
360+
.. availability:: Unix, Windows.
361361

362362
.. versionchanged:: 3.6
363363
Accepts a :term:`path-like object`.
@@ -369,7 +369,7 @@ the :mod:`glob` module.)
369369
This is determined by the device number and i-node number and raises an
370370
exception if an :func:`os.stat` call on either pathname fails.
371371

372-
Availability: Unix, Windows.
372+
.. availability:: Unix, Windows.
373373

374374
.. versionchanged:: 3.2
375375
Added Windows support.
@@ -385,7 +385,7 @@ the :mod:`glob` module.)
385385

386386
Return ``True`` if the file descriptors *fp1* and *fp2* refer to the same file.
387387

388-
Availability: Unix, Windows.
388+
.. availability:: Unix, Windows.
389389

390390
.. versionchanged:: 3.2
391391
Added Windows support.
@@ -401,7 +401,7 @@ the :mod:`glob` module.)
401401
:func:`os.lstat`, or :func:`os.stat`. This function implements the
402402
underlying comparison used by :func:`samefile` and :func:`sameopenfile`.
403403

404-
Availability: Unix, Windows.
404+
.. availability:: Unix, Windows.
405405

406406
.. versionchanged:: 3.4
407407
Added Windows support.

0 commit comments

Comments
 (0)