Skip to content

Commit 0fb593c

Browse files
committed
Deploying to gh-pages from @ c05a42a 🚀
1 parent 78863cf commit 0fb593c

File tree

541 files changed

+4636
-4287
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

541 files changed

+4636
-4287
lines changed

.buildinfo

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# Sphinx build info version 1
22
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done.
3-
config: 504ff18b217855dba7d76c99e50837cf
3+
config: b892372dbac8a23f905156f1486158a6
44
tags: 645f666f9bcd5a90fca523b33c5a78b7

_sources/library/csv.rst.txt

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,11 @@ The :mod:`csv` module defines the following functions:
5555

5656
.. function:: reader(csvfile, dialect='excel', **fmtparams)
5757

58-
Return a reader object which will iterate over lines in the given *csvfile*.
59-
*csvfile* can be any object which supports the :term:`iterator` protocol and returns a
60-
string each time its :meth:`!__next__` method is called --- :term:`file objects
61-
<file object>` and list objects are both suitable. If *csvfile* is a file object,
58+
Return a :ref:`reader object <reader-objects>` that will process
59+
lines from the given *csvfile*. A csvfile must be an iterable of
60+
strings, each in the reader's defined csv format.
61+
A csvfile is most commonly a file-like object or list.
62+
If *csvfile* is a file object,
6263
it should be opened with ``newline=''``. [1]_ An optional
6364
*dialect* parameter can be given which is used to define a set of parameters
6465
specific to a particular CSV dialect. It may be an instance of a subclass of
@@ -449,6 +450,8 @@ Dialects support the following attributes:
449450
When ``True``, raise exception :exc:`Error` on bad CSV input.
450451
The default is ``False``.
451452

453+
.. _reader-objects:
454+
452455
Reader Objects
453456
--------------
454457

_sources/library/datetime.rst.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1976,7 +1976,8 @@ Examples of working with a :class:`.time` object::
19761976
American EST and EDT.
19771977

19781978
Special requirement for pickling: A :class:`tzinfo` subclass must have an
1979-
:meth:`__init__` method that can be called with no arguments, otherwise it can be
1979+
:meth:`~object.__init__` method that can be called with no arguments,
1980+
otherwise it can be
19801981
pickled but possibly not unpickled again. This is a technical requirement that
19811982
may be relaxed in the future.
19821983

_sources/library/exceptions.rst.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1005,9 +1005,9 @@ their subgroups based on the types of the contained exceptions.
10051005
True
10061006

10071007

1008-
Note that :exc:`BaseExceptionGroup` defines :meth:`__new__`, so
1008+
Note that :exc:`BaseExceptionGroup` defines :meth:`~object.__new__`, so
10091009
subclasses that need a different constructor signature need to
1010-
override that rather than :meth:`__init__`. For example, the following
1010+
override that rather than :meth:`~object.__init__`. For example, the following
10111011
defines an exception group subclass which accepts an exit_code and
10121012
and constructs the group's message from it. ::
10131013

_sources/library/itertools.rst.txt

Lines changed: 33 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -914,14 +914,15 @@ which incur interpreter overhead.
914914
# grouper('ABCDEFG', 3, incomplete='strict') --> ABC DEF ValueError
915915
# grouper('ABCDEFG', 3, incomplete='ignore') --> ABC DEF
916916
args = [iter(iterable)] * n
917-
if incomplete == 'fill':
918-
return zip_longest(*args, fillvalue=fillvalue)
919-
if incomplete == 'strict':
920-
return zip(*args, strict=True)
921-
if incomplete == 'ignore':
922-
return zip(*args)
923-
else:
924-
raise ValueError('Expected fill, strict, or ignore')
917+
match incomplete:
918+
case 'fill':
919+
return zip_longest(*args, fillvalue=fillvalue)
920+
case 'strict':
921+
return zip(*args, strict=True)
922+
case 'ignore':
923+
return zip(*args)
924+
case _:
925+
raise ValueError('Expected fill, strict, or ignore')
925926
926927
def sliding_window(iterable, n):
927928
# sliding_window('ABCDEFG', 4) --> ABCD BCDE CDEF DEFG
@@ -1035,10 +1036,15 @@ The following recipes have a more mathematical flavor:
10351036
# sum_of_squares([10, 20, 30]) -> 1400
10361037
return math.sumprod(*tee(it))
10371038
1038-
def transpose(it):
1039-
"Swap the rows and columns of the input."
1039+
def reshape(matrix, cols):
1040+
"Reshape a 2-D matrix to have a given number of columns."
1041+
# reshape([(0, 1), (2, 3), (4, 5)], 3) --> (0, 1, 2), (3, 4, 5)
1042+
return batched(chain.from_iterable(matrix), cols)
1043+
1044+
def transpose(matrix):
1045+
"Swap the rows and columns of a 2-D matrix."
10401046
# transpose([(1, 2, 3), (11, 22, 33)]) --> (1, 11) (2, 22) (3, 33)
1041-
return zip(*it, strict=True)
1047+
return zip(*matrix, strict=True)
10421048
10431049
def matmul(m1, m2):
10441050
"Multiply two matrices."
@@ -1253,6 +1259,22 @@ The following recipes have a more mathematical flavor:
12531259
>>> sum_of_squares([10, 20, 30])
12541260
1400
12551261

1262+
>>> list(reshape([(0, 1), (2, 3), (4, 5)], 3))
1263+
[(0, 1, 2), (3, 4, 5)]
1264+
>>> M = [(0, 1, 2, 3), (4, 5, 6, 7), (8, 9, 10, 11)]
1265+
>>> list(reshape(M, 1))
1266+
[(0,), (1,), (2,), (3,), (4,), (5,), (6,), (7,), (8,), (9,), (10,), (11,)]
1267+
>>> list(reshape(M, 2))
1268+
[(0, 1), (2, 3), (4, 5), (6, 7), (8, 9), (10, 11)]
1269+
>>> list(reshape(M, 3))
1270+
[(0, 1, 2), (3, 4, 5), (6, 7, 8), (9, 10, 11)]
1271+
>>> list(reshape(M, 4))
1272+
[(0, 1, 2, 3), (4, 5, 6, 7), (8, 9, 10, 11)]
1273+
>>> list(reshape(M, 6))
1274+
[(0, 1, 2, 3, 4, 5), (6, 7, 8, 9, 10, 11)]
1275+
>>> list(reshape(M, 12))
1276+
[(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11)]
1277+
12561278
>>> list(transpose([(1, 2, 3), (11, 22, 33)]))
12571279
[(1, 11), (2, 22), (3, 33)]
12581280

_sources/library/numbers.rst.txt

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
--------------
1010

11-
The :mod:`numbers` module (:pep:`3141`) defines a hierarchy of numeric
11+
The :mod:`!numbers` module (:pep:`3141`) defines a hierarchy of numeric
1212
:term:`abstract base classes <abstract base class>` which progressively define
1313
more operations. None of the types defined in this module are intended to be instantiated.
1414

@@ -45,7 +45,7 @@ The numeric tower
4545

4646
.. class:: Real
4747

48-
To :class:`Complex`, :class:`Real` adds the operations that work on real
48+
To :class:`Complex`, :class:`!Real` adds the operations that work on real
4949
numbers.
5050

5151
In short, those are: a conversion to :class:`float`, :func:`math.trunc`,
@@ -126,7 +126,8 @@ We want to implement the arithmetic operations so that mixed-mode
126126
operations either call an implementation whose author knew about the
127127
types of both arguments, or convert both to the nearest built in type
128128
and do the operation there. For subtypes of :class:`Integral`, this
129-
means that :meth:`__add__` and :meth:`__radd__` should be defined as::
129+
means that :meth:`~object.__add__` and :meth:`~object.__radd__` should be
130+
defined as::
130131

131132
class MyIntegral(Integral):
132133

@@ -160,15 +161,15 @@ refer to ``MyIntegral`` and ``OtherTypeIKnowAbout`` as
160161
of :class:`Complex` (``a : A <: Complex``), and ``b : B <:
161162
Complex``. I'll consider ``a + b``:
162163

163-
1. If ``A`` defines an :meth:`__add__` which accepts ``b``, all is
164+
1. If ``A`` defines an :meth:`~object.__add__` which accepts ``b``, all is
164165
well.
165166
2. If ``A`` falls back to the boilerplate code, and it were to
166-
return a value from :meth:`__add__`, we'd miss the possibility
167-
that ``B`` defines a more intelligent :meth:`__radd__`, so the
167+
return a value from :meth:`~object.__add__`, we'd miss the possibility
168+
that ``B`` defines a more intelligent :meth:`~object.__radd__`, so the
168169
boilerplate should return :const:`NotImplemented` from
169-
:meth:`__add__`. (Or ``A`` may not implement :meth:`__add__` at
170+
:meth:`!__add__`. (Or ``A`` may not implement :meth:`!__add__` at
170171
all.)
171-
3. Then ``B``'s :meth:`__radd__` gets a chance. If it accepts
172+
3. Then ``B``'s :meth:`~object.__radd__` gets a chance. If it accepts
172173
``a``, all is well.
173174
4. If it falls back to the boilerplate, there are no more possible
174175
methods to try, so this is where the default implementation
@@ -180,7 +181,7 @@ Complex``. I'll consider ``a + b``:
180181

181182
If ``A <: Complex`` and ``B <: Real`` without sharing any other knowledge,
182183
then the appropriate shared operation is the one involving the built
183-
in :class:`complex`, and both :meth:`__radd__` s land there, so ``a+b
184+
in :class:`complex`, and both :meth:`~object.__radd__` s land there, so ``a+b
184185
== b+a``.
185186

186187
Because most of the operations on any given type will be very similar,

_sources/library/os.rst.txt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4165,6 +4165,11 @@ written in Python, such as a mail server's external command delivery program.
41654165
If you use TLS sockets in an application calling ``fork()``, see
41664166
the warning in the :mod:`ssl` documentation.
41674167

4168+
.. warning::
4169+
4170+
On macOS the use of this function is unsafe when mixed with using
4171+
higher-level system APIs, and that includes using :mod:`urllib.request`.
4172+
41684173
.. versionchanged:: 3.8
41694174
Calling ``fork()`` in a subinterpreter is no longer supported
41704175
(:exc:`RuntimeError` is raised).
@@ -4204,6 +4209,11 @@ written in Python, such as a mail server's external command delivery program.
42044209

42054210
.. audit-event:: os.forkpty "" os.forkpty
42064211

4212+
.. warning::
4213+
4214+
On macOS the use of this function is unsafe when mixed with using
4215+
higher-level system APIs, and that includes using :mod:`urllib.request`.
4216+
42074217
.. versionchanged:: 3.12
42084218
If Python is able to detect that your process has multiple
42094219
threads, this now raises a :exc:`DeprecationWarning`. See the

_sources/library/pty.rst.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@ The :mod:`pty` module defines the following functions:
3333
file descriptor connected to the child's controlling terminal (and also to the
3434
child's standard input and output).
3535

36+
.. warning:: On macOS the use of this function is unsafe when mixed with using
37+
higher-level system APIs, and that includes using :mod:`urllib.request`.
38+
3639

3740
.. function:: openpty()
3841

_sources/library/tarfile.rst.txt

Lines changed: 56 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ Some facts and figures:
116116
``'filemode|[compression]'``. :func:`tarfile.open` will return a :class:`TarFile`
117117
object that processes its data as a stream of blocks. No random seeking will
118118
be done on the file. If given, *fileobj* may be any object that has a
119-
:meth:`read` or :meth:`write` method (depending on the *mode*). *bufsize*
119+
:meth:`~io.TextIOBase.read` or :meth:`~io.TextIOBase.write` method (depending on the *mode*). *bufsize*
120120
specifies the blocksize and defaults to ``20 * 512`` bytes. Use this variant
121121
in combination with e.g. ``sys.stdin``, a socket :term:`file object` or a tape
122122
device. However, such a :class:`TarFile` object is limited in that it does
@@ -255,6 +255,51 @@ The following constants are available at the module level:
255255
The default character encoding: ``'utf-8'`` on Windows, the value returned by
256256
:func:`sys.getfilesystemencoding` otherwise.
257257

258+
.. data:: REGTYPE
259+
AREGTYPE
260+
261+
A regular file :attr:`~TarInfo.type`.
262+
263+
.. data:: LNKTYPE
264+
265+
A link (inside tarfile) :attr:`~TarInfo.type`.
266+
267+
.. data:: SYMTYPE
268+
269+
A symbolic link :attr:`~TarInfo.type`.
270+
271+
.. data:: CHRTYPE
272+
273+
A character special device :attr:`~TarInfo.type`.
274+
275+
.. data:: BLKTYPE
276+
277+
A block special device :attr:`~TarInfo.type`.
278+
279+
.. data:: DIRTYPE
280+
281+
A directory :attr:`~TarInfo.type`.
282+
283+
.. data:: FIFOTYPE
284+
285+
A FIFO special device :attr:`~TarInfo.type`.
286+
287+
.. data:: CONTTYPE
288+
289+
A contiguous file :attr:`~TarInfo.type`.
290+
291+
.. data:: GNUTYPE_LONGNAME
292+
293+
A GNU tar longname :attr:`~TarInfo.type`.
294+
295+
.. data:: GNUTYPE_LONGLINK
296+
297+
A GNU tar longlink :attr:`~TarInfo.type`.
298+
299+
.. data:: GNUTYPE_SPARSE
300+
301+
A GNU tar sparse file :attr:`~TarInfo.type`.
302+
258303

259304
Each of the following constants defines a tar archive format that the
260305
:mod:`tarfile` module is able to create. See section :ref:`tar-formats` for
@@ -325,7 +370,7 @@ be finalized; only the internally used file object will be closed. See the
325370

326371
*name* is the pathname of the archive. *name* may be a :term:`path-like object`.
327372
It can be omitted if *fileobj* is given.
328-
In this case, the file object's :attr:`name` attribute is used if it exists.
373+
In this case, the file object's :attr:`!name` attribute is used if it exists.
329374

330375
*mode* is either ``'r'`` to read from an existing archive, ``'a'`` to append
331376
data to an existing file, ``'w'`` to create a new file overwriting an existing
@@ -359,7 +404,7 @@ be finalized; only the internally used file object will be closed. See the
359404
messages). The messages are written to ``sys.stderr``.
360405

361406
*errorlevel* controls how extraction errors are handled,
362-
see :attr:`the corresponding attribute <~TarFile.errorlevel>`.
407+
see :attr:`the corresponding attribute <TarFile.errorlevel>`.
363408

364409
The *encoding* and *errors* arguments define the character encoding to be
365410
used for reading or writing the archive and how conversion errors are going
@@ -640,8 +685,8 @@ It does *not* contain the file's data itself.
640685
:meth:`~TarFile.getmember`, :meth:`~TarFile.getmembers` and
641686
:meth:`~TarFile.gettarinfo`.
642687

643-
Modifying the objects returned by :meth:`~!TarFile.getmember` or
644-
:meth:`~!TarFile.getmembers` will affect all subsequent
688+
Modifying the objects returned by :meth:`~TarFile.getmember` or
689+
:meth:`~TarFile.getmembers` will affect all subsequent
645690
operations on the archive.
646691
For cases where this is unwanted, you can use :mod:`copy.copy() <copy>` or
647692
call the :meth:`~TarInfo.replace` method to create a modified copy in one step.
@@ -790,8 +835,8 @@ A ``TarInfo`` object has the following public data attributes:
790835

791836
A dictionary containing key-value pairs of an associated pax extended header.
792837

793-
.. method:: TarInfo.replace(name=..., mtime=..., mode=..., linkname=...,
794-
uid=..., gid=..., uname=..., gname=...,
838+
.. method:: TarInfo.replace(name=..., mtime=..., mode=..., linkname=..., \
839+
uid=..., gid=..., uname=..., gname=..., \
795840
deep=True)
796841

797842
.. versionadded:: 3.12
@@ -811,7 +856,7 @@ A :class:`TarInfo` object also provides some convenient query methods:
811856

812857
.. method:: TarInfo.isfile()
813858

814-
Return :const:`True` if the :class:`Tarinfo` object is a regular file.
859+
Return :const:`True` if the :class:`TarInfo` object is a regular file.
815860

816861

817862
.. method:: TarInfo.isreg()
@@ -947,7 +992,7 @@ reused in custom filters:
947992
path (after following symlinks) would end up outside the destination.
948993
This raises :class:`~tarfile.OutsideDestinationError`.
949994
- Clear high mode bits (setuid, setgid, sticky) and group/other write bits
950-
(:const:`~stat.S_IWGRP`|:const:`~stat.S_IWOTH`).
995+
(:const:`~stat.S_IWGRP` | :const:`~stat.S_IWOTH`).
951996

952997
Return the modified ``TarInfo`` member.
953998

@@ -972,9 +1017,9 @@ reused in custom filters:
9721017
- For regular files, including hard links:
9731018

9741019
- Set the owner read and write permissions
975-
(:const:`~stat.S_IRUSR`|:const:`~stat.S_IWUSR`).
1020+
(:const:`~stat.S_IRUSR` | :const:`~stat.S_IWUSR`).
9761021
- Remove the group & other executable permission
977-
(:const:`~stat.S_IXGRP`|:const:`~stat.S_IXOTH`)
1022+
(:const:`~stat.S_IXGRP` | :const:`~stat.S_IXOTH`)
9781023
if the owner doesn’t have it (:const:`~stat.S_IXUSR`).
9791024

9801025
- For other files (directories), set ``mode`` to ``None``, so

_sources/library/test.rst.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1408,7 +1408,8 @@ The :mod:`test.support.os_helper` module provides support for os tests.
14081408

14091409
.. class:: FakePath(path)
14101410

1411-
Simple :term:`path-like object`. It implements the :meth:`__fspath__`
1411+
Simple :term:`path-like object`. It implements the
1412+
:meth:`~os.PathLike.__fspath__`
14121413
method which just returns the *path* argument. If *path* is an exception,
14131414
it will be raised in :meth:`!__fspath__`.
14141415

0 commit comments

Comments
 (0)