Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e78341d

Browse files
committed
Catch up with main
2 parents 1a956bd + 5094690 commit e78341d

122 files changed

Lines changed: 1298 additions & 686 deletions

File tree

Some content is hidden

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

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ repos:
2828
hooks:
2929
- id: sphinx-lint
3030
args: [--enable=default-role]
31-
files: ^Doc/|^Misc/NEWS.d/next/
31+
files: ^Doc/|^Misc/NEWS.d/
3232

3333
- repo: meta
3434
hooks:

Doc/c-api/complex.rst

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,11 +117,29 @@ Complex Numbers as Python Objects
117117
118118
Return the real part of *op* as a C :c:expr:`double`.
119119
120+
If *op* is not a Python complex number object but has a
121+
:meth:`~object.__complex__` method, this method will first be called to
122+
convert *op* to a Python complex number object. If :meth:`!__complex__` is
123+
not defined then it falls back to call :c:func:`PyFloat_AsDouble` and
124+
returns its result. Upon failure, this method returns ``-1.0``, so one
125+
should call :c:func:`PyErr_Occurred` to check for errors.
126+
127+
.. versionchanged:: 3.13
128+
Use :meth:`~object.__complex__` if available.
120129
121130
.. c:function:: double PyComplex_ImagAsDouble(PyObject *op)
122131
123132
Return the imaginary part of *op* as a C :c:expr:`double`.
124133
134+
If *op* is not a Python complex number object but has a
135+
:meth:`~object.__complex__` method, this method will first be called to
136+
convert *op* to a Python complex number object. If :meth:`!__complex__` is
137+
not defined then it falls back to call :c:func:`PyFloat_AsDouble` and
138+
returns ``0.0`` on success. Upon failure, this method returns ``-1.0``, so
139+
one should call :c:func:`PyErr_Occurred` to check for errors.
140+
141+
.. versionchanged:: 3.13
142+
Use :meth:`~object.__complex__` if available.
125143
126144
.. c:function:: Py_complex PyComplex_AsCComplex(PyObject *op)
127145

Doc/howto/urllib2.rst

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -392,16 +392,16 @@ info and geturl
392392
===============
393393

394394
The response returned by urlopen (or the :exc:`~urllib.error.HTTPError` instance) has two
395-
useful methods :meth:`info` and :meth:`geturl` and is defined in the module
396-
:mod:`urllib.response`..
395+
useful methods :meth:`!info` and :meth:`!geturl` and is defined in the module
396+
:mod:`urllib.response`.
397397

398-
**geturl** - this returns the real URL of the page fetched. This is useful
399-
because ``urlopen`` (or the opener object used) may have followed a
400-
redirect. The URL of the page fetched may not be the same as the URL requested.
398+
* **geturl** - this returns the real URL of the page fetched. This is useful
399+
because ``urlopen`` (or the opener object used) may have followed a
400+
redirect. The URL of the page fetched may not be the same as the URL requested.
401401

402-
**info** - this returns a dictionary-like object that describes the page
403-
fetched, particularly the headers sent by the server. It is currently an
404-
:class:`http.client.HTTPMessage` instance.
402+
* **info** - this returns a dictionary-like object that describes the page
403+
fetched, particularly the headers sent by the server. It is currently an
404+
:class:`http.client.HTTPMessage` instance.
405405

406406
Typical headers include 'Content-length', 'Content-type', and so on. See the
407407
`Quick Reference to HTTP Headers <https://jkorpela.fi/http.html>`_
@@ -507,7 +507,7 @@ than the URL you pass to .add_password() will also match. ::
507507

508508
In the above example we only supplied our ``HTTPBasicAuthHandler`` to
509509
``build_opener``. By default openers have the handlers for normal situations
510-
-- ``ProxyHandler`` (if a proxy setting such as an :envvar:`http_proxy`
510+
-- ``ProxyHandler`` (if a proxy setting such as an :envvar:`!http_proxy`
511511
environment variable is set), ``UnknownHandler``, ``HTTPHandler``,
512512
``HTTPDefaultErrorHandler``, ``HTTPRedirectHandler``, ``FTPHandler``,
513513
``FileHandler``, ``DataHandler``, ``HTTPErrorProcessor``.

Doc/library/functions.rst

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -668,16 +668,15 @@ are always available. They are listed here in alphabetical order.
668668
sign: "+" | "-"
669669
infinity: "Infinity" | "inf"
670670
nan: "nan"
671-
digitpart: `!digit` (["_"] `!digit`)*
671+
digit: <a Unicode decimal digit, i.e. characters in Unicode general category Nd>
672+
digitpart: `digit` (["_"] `digit`)*
672673
number: [`digitpart`] "." `digitpart` | `digitpart` ["."]
673674
exponent: ("e" | "E") ["+" | "-"] `digitpart`
674675
floatnumber: number [`exponent`]
675676
floatvalue: [`sign`] (`floatnumber` | `infinity` | `nan`)
676677

677-
Here ``digit`` is a Unicode decimal digit (character in the Unicode general
678-
category ``Nd``). Case is not significant, so, for example, "inf", "Inf",
679-
"INFINITY", and "iNfINity" are all acceptable spellings for positive
680-
infinity.
678+
Case is not significant, so, for example, "inf", "Inf", "INFINITY", and
679+
"iNfINity" are all acceptable spellings for positive infinity.
681680

682681
Otherwise, if the argument is an integer or a floating point number, a
683682
floating point number with the same value (within Python's floating point

Doc/library/http.client.rst

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ The module provides the following classes:
9292
.. versionchanged:: 3.4.3
9393
This class now performs all the necessary certificate and hostname checks
9494
by default. To revert to the previous, unverified, behavior
95-
:func:`ssl._create_unverified_context` can be passed to the *context*
95+
:func:`!ssl._create_unverified_context` can be passed to the *context*
9696
parameter.
9797

9898
.. versionchanged:: 3.8
@@ -103,7 +103,7 @@ The module provides the following classes:
103103
.. versionchanged:: 3.10
104104
This class now sends an ALPN extension with protocol indicator
105105
``http/1.1`` when no *context* is given. Custom *context* should set
106-
ALPN protocols with :meth:`~ssl.SSLContext.set_alpn_protocol`.
106+
ALPN protocols with :meth:`~ssl.SSLContext.set_alpn_protocols`.
107107

108108
.. versionchanged:: 3.12
109109
The deprecated *key_file*, *cert_file* and *check_hostname* parameters
@@ -124,7 +124,7 @@ This module provides the following function:
124124
.. function:: parse_headers(fp)
125125

126126
Parse the headers from a file pointer *fp* representing a HTTP
127-
request/response. The file has to be a :class:`BufferedIOBase` reader
127+
request/response. The file has to be a :class:`~io.BufferedIOBase` reader
128128
(i.e. not text) and must provide a valid :rfc:`2822` style header.
129129

130130
This function returns an instance of :class:`http.client.HTTPMessage`
@@ -416,7 +416,7 @@ HTTPConnection Objects
416416
.. versionadded:: 3.7
417417

418418

419-
As an alternative to using the :meth:`request` method described above, you can
419+
As an alternative to using the :meth:`~HTTPConnection.request` method described above, you can
420420
also send your request step by step, by using the four functions below.
421421

422422

@@ -648,6 +648,8 @@ method attribute. Here is an example session that uses the ``PUT`` method::
648648
HTTPMessage Objects
649649
-------------------
650650

651+
.. class:: HTTPMessage(email.message.Message)
652+
651653
An :class:`http.client.HTTPMessage` instance holds the headers from an HTTP
652654
response. It is implemented using the :class:`email.message.Message` class.
653655

Doc/library/os.path.rst

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -239,12 +239,16 @@ the :mod:`glob` module.)
239239
.. function:: isabs(path)
240240

241241
Return ``True`` if *path* is an absolute pathname. On Unix, that means it
242-
begins with a slash, on Windows that it begins with a (back)slash after chopping
243-
off a potential drive letter.
242+
begins with a slash, on Windows that it begins with two (back)slashes, or a
243+
drive letter, colon, and (back)slash together.
244244

245245
.. versionchanged:: 3.6
246246
Accepts a :term:`path-like object`.
247247

248+
.. versionchanged:: 3.13
249+
On Windows, returns ``False`` if the given path starts with exactly one
250+
(back)slash.
251+
248252

249253
.. function:: isfile(path)
250254

Doc/library/stat.rst

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -350,6 +350,12 @@ The following flags can also be used in the *mode* argument of :func:`os.chmod`:
350350

351351
The following flags can be used in the *flags* argument of :func:`os.chflags`:
352352

353+
.. data:: UF_SETTABLE
354+
355+
All user settable flags.
356+
357+
.. versionadded: 3.13
358+
353359
.. data:: UF_NODUMP
354360

355361
Do not dump the file.
@@ -374,10 +380,44 @@ The following flags can be used in the *flags* argument of :func:`os.chflags`:
374380

375381
The file is stored compressed (macOS 10.6+).
376382

383+
.. data:: UF_TRACKED
384+
385+
Used for handling document IDs (macOS)
386+
387+
.. versionadded: 3.13
388+
389+
.. data:: UF_DATAVAULT
390+
391+
The file needs an entitlement for reading or writing (macOS 10.13+)
392+
393+
.. versionadded: 3.13
394+
377395
.. data:: UF_HIDDEN
378396

379397
The file should not be displayed in a GUI (macOS 10.5+).
380398

399+
.. data:: SF_SETTABLE
400+
401+
All super-user changeable flags
402+
403+
.. versionadded: 3.13
404+
405+
.. data:: SF_SUPPORTED
406+
407+
All super-user supported flags
408+
409+
.. availability:: macOS
410+
411+
.. versionadded: 3.13
412+
413+
.. data:: SF_SYNTHETIC
414+
415+
All super-user read-only synthetic flags
416+
417+
.. availability:: macOS
418+
419+
.. versionadded: 3.13
420+
381421
.. data:: SF_ARCHIVED
382422

383423
The file may be archived.
@@ -390,6 +430,12 @@ The following flags can be used in the *flags* argument of :func:`os.chflags`:
390430

391431
The file may only be appended to.
392432

433+
.. data:: SF_RESTRICTED
434+
435+
The file needs an entitlement to write to (macOS 10.13+)
436+
437+
.. versionadded: 3.13
438+
393439
.. data:: SF_NOUNLINK
394440

395441
The file may not be renamed or deleted.
@@ -398,6 +444,18 @@ The following flags can be used in the *flags* argument of :func:`os.chflags`:
398444

399445
The file is a snapshot file.
400446

447+
.. data:: SF_FIRMLINK
448+
449+
The file is a firmlink (macOS 10.15+)
450+
451+
.. versionadded: 3.13
452+
453+
.. data:: SF_DATALESS
454+
455+
The file is a dataless object (macOS 10.15+)
456+
457+
.. versionadded: 3.13
458+
401459
See the \*BSD or macOS systems man page :manpage:`chflags(2)` for more information.
402460

403461
On Windows, the following file attribute constants are available for use when

Doc/library/tarfile.rst

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -837,6 +837,36 @@ A ``TarInfo`` object has the following public data attributes:
837837
:meth:`~TarFile.extractall`, causing extraction to skip applying this
838838
attribute.
839839

840+
.. attribute:: TarInfo.chksum
841+
842+
Header checksum.
843+
844+
845+
.. attribute:: TarInfo.devmajor
846+
847+
Device major number.
848+
849+
850+
.. attribute:: TarInfo.devminor
851+
852+
Device minor number.
853+
854+
855+
.. attribute:: TarInfo.offset
856+
857+
The tar header starts here.
858+
859+
860+
.. attribute:: TarInfo.offset_data
861+
862+
The file's data starts here.
863+
864+
865+
.. attribute:: TarInfo.sparse
866+
867+
Sparse member information.
868+
869+
840870
.. attribute:: TarInfo.pax_headers
841871
:type: dict
842872

Doc/library/unittest.mock.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2009,8 +2009,8 @@ Mocking Magic Methods
20092009
~~~~~~~~~~~~~~~~~~~~~
20102010

20112011
:class:`Mock` supports mocking the Python protocol methods, also known as
2012-
"magic methods". This allows mock objects to replace containers or other
2013-
objects that implement Python protocols.
2012+
:term:`"magic methods" <magic method>`. This allows mock objects to replace
2013+
containers or other objects that implement Python protocols.
20142014

20152015
Because magic methods are looked up differently from normal methods [#]_, this
20162016
support has been specially implemented. This means that only specific magic
@@ -2108,8 +2108,8 @@ There are two ``MagicMock`` variants: :class:`MagicMock` and :class:`NonCallable
21082108
.. class:: MagicMock(*args, **kw)
21092109

21102110
``MagicMock`` is a subclass of :class:`Mock` with default implementations
2111-
of most of the magic methods. You can use ``MagicMock`` without having to
2112-
configure the magic methods yourself.
2111+
of most of the :term:`magic methods <magic method>`. You can use
2112+
``MagicMock`` without having to configure the magic methods yourself.
21132113

21142114
The constructor parameters have the same meaning as for :class:`Mock`.
21152115

0 commit comments

Comments
 (0)