Skip to content

Commit

Permalink
Deploying to gh-pages from @ 6fcd273 🚀
Browse files Browse the repository at this point in the history
  • Loading branch information
mattwang44 committed May 16, 2024
1 parent ea2fe98 commit 1514f5a
Show file tree
Hide file tree
Showing 535 changed files with 766 additions and 1,322 deletions.
2 changes: 1 addition & 1 deletion .buildinfo
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Sphinx build info version 1
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done.
config: e7ec7013a5b3e2ddcf33529b2d5be2bb
config: a722cb470f646be1f9759369084d7fc6
tags: 645f666f9bcd5a90fca523b33c5a78b7
8 changes: 6 additions & 2 deletions _sources/library/functools.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -644,8 +644,9 @@ The :mod:`functools` module defines the following functions:
attributes of the wrapper function are updated with the corresponding attributes
from the original function. The default values for these arguments are the
module level constants ``WRAPPER_ASSIGNMENTS`` (which assigns to the wrapper
function's ``__module__``, ``__name__``, ``__qualname__``, ``__annotations__``
and ``__doc__``, the documentation string) and ``WRAPPER_UPDATES`` (which
function's ``__module__``, ``__name__``, ``__qualname__``, ``__annotations__``,
``__type_params__``, and ``__doc__``, the documentation string)
and ``WRAPPER_UPDATES`` (which
updates the wrapper function's ``__dict__``, i.e. the instance dictionary).

To allow access to the original function for introspection and other purposes
Expand Down Expand Up @@ -675,6 +676,9 @@ The :mod:`functools` module defines the following functions:
function, even if that function defined a ``__wrapped__`` attribute.
(see :issue:`17482`)

.. versionchanged:: 3.12
The ``__type_params__`` attribute is now copied by default.


.. decorator:: wraps(wrapped, assigned=WRAPPER_ASSIGNMENTS, updated=WRAPPER_UPDATES)

Expand Down
71 changes: 31 additions & 40 deletions _sources/library/itertools.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -122,15 +122,15 @@ loops that truncate the stream.
# accumulate([1,2,3,4,5]) → 1 3 6 10 15
# accumulate([1,2,3,4,5], initial=100) → 100 101 103 106 110 115
# accumulate([1,2,3,4,5], operator.mul) → 1 2 6 24 120
it = iter(iterable)
iterator = iter(iterable)
total = initial
if initial is None:
try:
total = next(it)
total = next(iterator)
except StopIteration:
return
yield total
for element in it:
for element in iterator:
total = func(total, element)
yield total

Expand Down Expand Up @@ -210,9 +210,8 @@ loops that truncate the stream.

def chain(*iterables):
# chain('ABC', 'DEF') → A B C D E F
for it in iterables:
for element in it:
yield element
for iterable in iterables:
yield from iterable


.. classmethod:: chain.from_iterable(iterable)
Expand All @@ -222,9 +221,8 @@ loops that truncate the stream.

def from_iterable(iterables):
# chain.from_iterable(['ABC', 'DEF']) → A B C D E F
for it in iterables:
for element in it:
yield element
for iterable in iterables:
yield from iterable


.. function:: combinations(iterable, r)
Expand Down Expand Up @@ -372,7 +370,7 @@ loops that truncate the stream.
saved.append(element)
while saved:
for element in saved:
yield element
yield element

Note, this member of the toolkit may require significant auxiliary storage
(depending on the length of the iterable).
Expand Down Expand Up @@ -607,10 +605,10 @@ loops that truncate the stream.
This function is roughly equivalent to the following code, except that the
actual implementation does not build up intermediate results in memory::

def product(*args, repeat=1):
def product(*iterables, repeat=1):
# product('ABCD', 'xy') → Ax Ay Bx By Cx Cy Dx Dy
# product(range(2), repeat=3) → 000 001 010 011 100 101 110 111
pools = [tuple(pool) for pool in args] * repeat
pools = [tuple(pool) for pool in iterables] * repeat
result = [[]]
for pool in pools:
result = [x+[y] for x in result for y in pool]
Expand Down Expand Up @@ -688,24 +686,22 @@ loops that truncate the stream.

Return *n* independent iterators from a single iterable.

The following Python code helps explain what *tee* does (although the actual
implementation is more complex and uses only a single underlying
:abbr:`FIFO (first-in, first-out)` queue)::
Roughly equivalent to::

def tee(iterable, n=2):
it = iter(iterable)
deques = [collections.deque() for i in range(n)]
def gen(mydeque):
while True:
if not mydeque: # when the local deque is empty
try:
newval = next(it) # fetch a new value and
except StopIteration:
return
for d in deques: # load it to all the deques
d.append(newval)
yield mydeque.popleft()
return tuple(gen(d) for d in deques)
iterator = iter(iterable)
empty_link = [None, None] # Singly linked list: [value, link]
return tuple(_tee(iterator, empty_link) for _ in range(n))

def _tee(iterator, link):
while True:
if link[1] is None:
try:
link[:] = [next(iterator), [None, None]]
except StopIteration:
return
value, link = link
yield value

Once a :func:`tee` has been created, the original *iterable* should not be
used anywhere else; otherwise, the *iterable* could get advanced without
Expand All @@ -727,17 +723,17 @@ loops that truncate the stream.
iterables are of uneven length, missing values are filled-in with *fillvalue*.
Iteration continues until the longest iterable is exhausted. Roughly equivalent to::

def zip_longest(*args, fillvalue=None):
def zip_longest(*iterables, fillvalue=None):
# zip_longest('ABCD', 'xy', fillvalue='-') → Ax By C- D-
iterators = [iter(it) for it in args]
iterators = [iter(it) for it in iterables]
num_active = len(iterators)
if not num_active:
return
while True:
values = []
for i, it in enumerate(iterators):
for i, iterator in enumerate(iterators):
try:
value = next(it)
value = next(iterator)
except StopIteration:
num_active -= 1
if not num_active:
Expand Down Expand Up @@ -792,6 +788,7 @@ and :term:`generators <generator>` which incur interpreter overhead.
.. testcode::

import collections
import contextlib
import functools
import math
import operator
Expand Down Expand Up @@ -934,32 +931,26 @@ and :term:`generators <generator>` which incur interpreter overhead.
# iter_index('AABCADEAF', 'A') → 0 1 4 7
seq_index = getattr(iterable, 'index', None)
if seq_index is None:
# Path for general iterables
iterator = islice(iterable, start, stop)
for i, element in enumerate(iterator, start):
if element is value or element == value:
yield i
else:
# Path for sequences with an index() method
stop = len(iterable) if stop is None else stop
i = start
try:
with contextlib.suppress(ValueError):
while True:
yield (i := seq_index(value, i, stop))
i += 1
except ValueError:
pass

def iter_except(func, exception, first=None):
"Convert a call-until-exception interface to an iterator interface."
# iter_except(d.popitem, KeyError) → non-blocking dictionary iterator
try:
with contextlib.suppress(exception):
if first is not None:
yield first()
while True:
yield func()
except exception:
pass


The following recipes have a more mathematical flavor:
Expand Down
7 changes: 7 additions & 0 deletions _sources/library/os.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2356,6 +2356,10 @@ features:
platform-dependent. On some platforms, they are ignored and you should call
:func:`chmod` explicitly to set them.

On Windows, a *mode* of ``0o700`` is specifically handled to apply access
control to the new directory such that only the current user and
administrators have access. Other values of *mode* are ignored.

This function can also support :ref:`paths relative to directory descriptors
<dir_fd>`.

Expand All @@ -2370,6 +2374,9 @@ features:
.. versionchanged:: 3.6
Accepts a :term:`path-like object`.

.. versionchanged:: 3.12.4
Windows now handles a *mode* of ``0o700``.


.. function:: makedirs(name, mode=0o777, exist_ok=False)

Expand Down
4 changes: 4 additions & 0 deletions _sources/library/pathlib.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -582,6 +582,10 @@ Pure paths provide the following methods and properties:
>>> PurePath('a/b.py').match(pattern)
True

.. note::
The recursive wildcard "``**``" isn't supported by this method (it acts
like non-recursive "``*``".)

.. versionchanged:: 3.12
Accepts an object implementing the :class:`os.PathLike` interface.

Expand Down
6 changes: 3 additions & 3 deletions _sources/library/secrets.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,13 @@ randomness that your operating system provides.
sources provided by the operating system. See
:class:`random.SystemRandom` for additional details.

.. function:: choice(sequence)
.. function:: choice(seq)

Return a randomly chosen element from a non-empty sequence.

.. function:: randbelow(n)
.. function:: randbelow(exclusive_upper_bound)

Return a random int in the range [0, *n*).
Return a random int in the range [0, *exclusive_upper_bound*).

.. function:: randbits(k)

Expand Down
2 changes: 1 addition & 1 deletion _sources/library/shutil.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ Directory and files operations
before removing the junction.

.. versionchanged:: 3.11
The *dir_fd* parameter.
Added the *dir_fd* parameter.

.. versionchanged:: 3.12
Added the *onexc* parameter, deprecated *onerror*.
Expand Down
11 changes: 11 additions & 0 deletions _sources/whatsnew/3.12.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -778,6 +778,13 @@ os
Both functions may be significantly faster on newer releases of
Windows. (Contributed by Steve Dower in :gh:`99726`.)

* As of 3.12.4, :func:`os.mkdir` and :func:`os.makedirs` on Windows
now support passing a *mode* value of ``0o700`` to apply access
control to the new directory. This implicitly affects
:func:`tempfile.mkdtemp` and is a mitigation for :cve:`2024-4030`.
Other values for *mode* continue to be ignored.
(Contributed by Steve Dower in :gh:`118486`.)

os.path
-------

Expand Down Expand Up @@ -925,6 +932,10 @@ tempfile
*delete_on_close* (Contributed by Evgeny Zorin in :gh:`58451`.)
* :func:`tempfile.mkdtemp` now always returns an absolute path, even if the
argument provided to the *dir* parameter is a relative path.
* As of 3.12.4 on Windows, the default mode ``0o700`` used by
:func:`tempfile.mkdtemp` now limits access to the new directory due to
changes to :func:`os.mkdir`. This is a mitigation for :cve:`2024-4030`.
(Contributed by Steve Dower in :gh:`118486`.)

threading
---------
Expand Down
3 changes: 1 addition & 2 deletions about.html
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@
<script type="text/javascript" src="_static/menu.js"></script>
<script type="text/javascript" src="_static/search-focus.js"></script>
<script type="text/javascript" src="_static/themetoggle.js"></script>

<meta name="readthedocs-addons-api-version" content="1">
<script type="text/javascript">
function onSwitch(event) {
Expand Down Expand Up @@ -402,7 +401,7 @@ <h3>瀏覽</h3>
<a href="https://www.python.org/psf/donations/">Please donate.</a>
<br />
<br />
最後更新於 May 09, 2024 (08:37 UTC)。
最後更新於 May 16, 2024 (07:44 UTC)。

<a href="/bugs.html">Found a bug</a>?

Expand Down
5 changes: 2 additions & 3 deletions bugs.html
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@
<script type="text/javascript" src="_static/menu.js"></script>
<script type="text/javascript" src="_static/search-focus.js"></script>
<script type="text/javascript" src="_static/themetoggle.js"></script>

<meta name="readthedocs-addons-api-version" content="1">
<script type="text/javascript">
function onSwitch(event) {
Expand Down Expand Up @@ -313,7 +312,7 @@ <h2>說明文件的錯誤<a class="headerlink" href="#documentation-bugs" title=
</section>
<section id="getting-started-contributing-to-python-yourself">
<span id="contributing-to-python"></span><h2>開始讓自己貢獻 Python<a class="headerlink" href="#getting-started-contributing-to-python-yourself" title="連結到這個標頭"></a></h2>
<p>除了只是回報您所發現的錯誤之外,同樣也歡迎您提交修正它們的修補程式 (patch)。您可以在 <a class="reference external" href="https://mail.python.org/mailman3/lists/core-mentorship.python.org/">Python 開發者指南</a>中找到如何開始修補 Python 的更多資訊。如果您有任何問題,<a class="reference external" href="https://devguide.python.org/">核心導師郵寄清單</a>是一個友善的地方,您可以在那裡得到,關於 Python 修正錯誤的過程中,所有問題的答案。</p>
<p>除了只是回報您所發現的錯誤之外,同樣也歡迎您提交修正它們的修補程式 (patch)。您可以在 <a class="reference external" href="https://devguide.python.org/">Python 開發者指南</a>中找到如何開始修補 Python 的更多資訊。如果您有任何問題,<a class="reference external" href="https://mail.python.org/mailman3/lists/core-mentorship.python.org/">核心導師郵寄清單</a>是一個友善的地方,您可以在那裡得到,關於 Python 修正錯誤的過程中,所有問題的答案。</p>
</section>
</section>

Expand Down Expand Up @@ -441,7 +440,7 @@ <h3>瀏覽</h3>
<a href="https://www.python.org/psf/donations/">Please donate.</a>
<br />
<br />
最後更新於 May 09, 2024 (08:37 UTC)。
最後更新於 May 16, 2024 (07:44 UTC)。

<a href="/bugs.html">Found a bug</a>?

Expand Down
3 changes: 1 addition & 2 deletions c-api/abstract.html
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@
<script type="text/javascript" src="../_static/menu.js"></script>
<script type="text/javascript" src="../_static/search-focus.js"></script>
<script type="text/javascript" src="../_static/themetoggle.js"></script>

<meta name="readthedocs-addons-api-version" content="1">
<script type="text/javascript">
function onSwitch(event) {
Expand Down Expand Up @@ -412,7 +411,7 @@ <h3>瀏覽</h3>
<a href="https://www.python.org/psf/donations/">Please donate.</a>
<br />
<br />
最後更新於 May 09, 2024 (08:37 UTC)。
最後更新於 May 16, 2024 (07:44 UTC)。

<a href="/bugs.html">Found a bug</a>?

Expand Down
3 changes: 1 addition & 2 deletions c-api/allocation.html
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@
<script type="text/javascript" src="../_static/menu.js"></script>
<script type="text/javascript" src="../_static/search-focus.js"></script>
<script type="text/javascript" src="../_static/themetoggle.js"></script>

<meta name="readthedocs-addons-api-version" content="1">
<script type="text/javascript">
function onSwitch(event) {
Expand Down Expand Up @@ -426,7 +425,7 @@ <h3>瀏覽</h3>
<a href="https://www.python.org/psf/donations/">Please donate.</a>
<br />
<br />
最後更新於 May 09, 2024 (08:37 UTC)。
最後更新於 May 16, 2024 (07:44 UTC)。

<a href="/bugs.html">Found a bug</a>?

Expand Down
3 changes: 1 addition & 2 deletions c-api/apiabiversion.html
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@
<script type="text/javascript" src="../_static/menu.js"></script>
<script type="text/javascript" src="../_static/search-focus.js"></script>
<script type="text/javascript" src="../_static/themetoggle.js"></script>

<meta name="readthedocs-addons-api-version" content="1">
<script type="text/javascript">
function onSwitch(event) {
Expand Down Expand Up @@ -458,7 +457,7 @@ <h3>瀏覽</h3>
<a href="https://www.python.org/psf/donations/">Please donate.</a>
<br />
<br />
最後更新於 May 09, 2024 (08:37 UTC)。
最後更新於 May 16, 2024 (07:44 UTC)。

<a href="/bugs.html">Found a bug</a>?

Expand Down
3 changes: 1 addition & 2 deletions c-api/arg.html
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@
<script type="text/javascript" src="../_static/menu.js"></script>
<script type="text/javascript" src="../_static/search-focus.js"></script>
<script type="text/javascript" src="../_static/themetoggle.js"></script>

<meta name="readthedocs-addons-api-version" content="1">
<script type="text/javascript">
function onSwitch(event) {
Expand Down Expand Up @@ -969,7 +968,7 @@ <h3>瀏覽</h3>
<a href="https://www.python.org/psf/donations/">Please donate.</a>
<br />
<br />
最後更新於 May 09, 2024 (08:37 UTC)。
最後更新於 May 16, 2024 (07:44 UTC)。

<a href="/bugs.html">Found a bug</a>?

Expand Down

0 comments on commit 1514f5a

Please sign in to comment.