Skip to content

Commit 4bd9683

Browse files
committed
Deploying to gh-pages from @ 86bf57d 🚀
1 parent d505463 commit 4bd9683

File tree

541 files changed

+5614
-5426
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

+5614
-5426
lines changed

.buildinfo

+1-1
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: b4de732a1adc31e490cff63dd5fff1f8
3+
config: 0ea7a2e7eec73f8cfb4ff36e251e0c7b
44
tags: 645f666f9bcd5a90fca523b33c5a78b7

_sources/c-api/tuple.rst.txt

+6
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,12 @@ Tuple Objects
5959
Return the object at position *pos* in the tuple pointed to by *p*. If *pos* is
6060
negative or out of bounds, return ``NULL`` and set an :exc:`IndexError` exception.
6161
62+
The returned reference is borrowed from the tuple *p*
63+
(that is: it is only valid as long as you hold a reference to *p*).
64+
To get a :term:`strong reference`, use
65+
:c:func:`Py_NewRef(PyTuple_GetItem(...)) <Py_NewRef>`
66+
or :c:func:`PySequence_GetItem`.
67+
6268
6369
.. c:function:: PyObject* PyTuple_GET_ITEM(PyObject *p, Py_ssize_t pos)
6470

_sources/c-api/typeobj.rst.txt

+2-1
Original file line numberDiff line numberDiff line change
@@ -1052,7 +1052,8 @@ and :c:data:`PyType_Type` effectively act as defaults.)
10521052
the type, and the type object is INCREF'ed when a new instance is created, and
10531053
DECREF'ed when an instance is destroyed (this does not apply to instances of
10541054
subtypes; only the type referenced by the instance's ob_type gets INCREF'ed or
1055-
DECREF'ed).
1055+
DECREF'ed). Heap types should also :ref:`support garbage collection <supporting-cycle-detection>`
1056+
as they can form a reference cycle with their own module object.
10561057

10571058
**Inheritance:**
10581059

_sources/library/ast.rst.txt

+3-2
Original file line numberDiff line numberDiff line change
@@ -2520,7 +2520,8 @@ to stdout. Otherwise, the content is read from stdin.
25202520
code that generated them. This is helpful for tools that make source code
25212521
transformations.
25222522

2523-
`leoAst.py <https://leoeditor.com/appendices.html#leoast-py>`_ unifies the
2523+
`leoAst.py <https://leo-editor.github.io/leo-editor/appendices.html#leoast-py>`_
2524+
unifies the
25242525
token-based and parse-tree-based views of python programs by inserting
25252526
two-way links between tokens and ast nodes.
25262527

@@ -2532,4 +2533,4 @@ to stdout. Otherwise, the content is read from stdin.
25322533
`Parso <https://parso.readthedocs.io>`_ is a Python parser that supports
25332534
error recovery and round-trip parsing for different Python versions (in
25342535
multiple Python versions). Parso is also able to list multiple syntax errors
2535-
in your python file.
2536+
in your Python file.

_sources/library/ctypes.rst.txt

+8-8
Original file line numberDiff line numberDiff line change
@@ -2072,13 +2072,13 @@ Utility functions
20722072
Does the same as the C ``sizeof`` operator.
20732073

20742074

2075-
.. function:: string_at(address, size=-1)
2075+
.. function:: string_at(ptr, size=-1)
20762076

2077-
This function returns the C string starting at memory address *address* as a bytes
2078-
object. If size is specified, it is used as size, otherwise the string is assumed
2077+
Return the byte string at *void \*ptr*.
2078+
If *size* is specified, it is used as size, otherwise the string is assumed
20792079
to be zero-terminated.
20802080

2081-
.. audit-event:: ctypes.string_at address,size ctypes.string_at
2081+
.. audit-event:: ctypes.string_at ptr,size ctypes.string_at
20822082

20832083

20842084
.. function:: WinError(code=None, descr=None)
@@ -2094,14 +2094,14 @@ Utility functions
20942094
alias of :exc:`OSError`.
20952095

20962096

2097-
.. function:: wstring_at(address, size=-1)
2097+
.. function:: wstring_at(ptr, size=-1)
20982098

2099-
This function returns the wide character string starting at memory address
2100-
*address* as a string. If *size* is specified, it is used as the number of
2099+
Return the wide-character string at *void \*ptr*.
2100+
If *size* is specified, it is used as the number of
21012101
characters of the string, otherwise the string is assumed to be
21022102
zero-terminated.
21032103

2104-
.. audit-event:: ctypes.wstring_at address,size ctypes.wstring_at
2104+
.. audit-event:: ctypes.wstring_at ptr,size ctypes.wstring_at
21052105

21062106

21072107
.. _ctypes-data-types:

_sources/library/datetime.rst.txt

+47-47
Original file line numberDiff line numberDiff line change
@@ -85,13 +85,13 @@ The :mod:`!datetime` module exports the following constants:
8585
.. data:: MINYEAR
8686

8787
The smallest year number allowed in a :class:`date` or :class:`.datetime` object.
88-
:const:`MINYEAR` is ``1``.
88+
:const:`MINYEAR` is 1.
8989

9090

9191
.. data:: MAXYEAR
9292

9393
The largest year number allowed in a :class:`date` or :class:`.datetime` object.
94-
:const:`MAXYEAR` is ``9999``.
94+
:const:`MAXYEAR` is 9999.
9595

9696
.. attribute:: UTC
9797

@@ -207,7 +207,7 @@ A :class:`timedelta` object represents a duration, the difference between two
207207

208208
.. class:: timedelta(days=0, seconds=0, microseconds=0, milliseconds=0, minutes=0, hours=0, weeks=0)
209209

210-
All arguments are optional and default to ``0``. Arguments may be integers
210+
All arguments are optional and default to 0. Arguments may be integers
211211
or floats, and may be positive or negative.
212212

213213
Only *days*, *seconds* and *microseconds* are stored internally.
@@ -280,7 +280,7 @@ Class attributes:
280280
The smallest possible difference between non-equal :class:`timedelta` objects,
281281
``timedelta(microseconds=1)``.
282282

283-
Note that, because of normalization, ``timedelta.max`` > ``-timedelta.min``.
283+
Note that, because of normalization, ``timedelta.max`` is greater than ``-timedelta.min``.
284284
``-timedelta.max`` is not representable as a :class:`timedelta` object.
285285

286286
Instance attributes (read-only):
@@ -302,26 +302,27 @@ Supported operations:
302302
+--------------------------------+-----------------------------------------------+
303303
| Operation | Result |
304304
+================================+===============================================+
305-
| ``t1 = t2 + t3`` | Sum of *t2* and *t3*. Afterwards *t1*-*t2* == |
306-
| | *t3* and *t1*-*t3* == *t2* are true. (1) |
305+
| ``t1 = t2 + t3`` | Sum of ``t2`` and ``t3``. |
306+
| | Afterwards ``t1 - t2 == t3`` and |
307+
| | ``t1 - t3 == t2`` are true. (1) |
307308
+--------------------------------+-----------------------------------------------+
308-
| ``t1 = t2 - t3`` | Difference of *t2* and *t3*. Afterwards *t1* |
309-
| | == *t2* - *t3* and *t2* == *t1* + *t3* are |
309+
| ``t1 = t2 - t3`` | Difference of ``t2`` and ``t3``. Afterwards |
310+
| | ``t1 == t2 - t3`` and ``t2 == t1 + t3`` are |
310311
| | true. (1)(6) |
311312
+--------------------------------+-----------------------------------------------+
312313
| ``t1 = t2 * i or t1 = i * t2`` | Delta multiplied by an integer. |
313-
| | Afterwards *t1* // i == *t2* is true, |
314+
| | Afterwards ``t1 // i == t2`` is true, |
314315
| | provided ``i != 0``. |
315316
+--------------------------------+-----------------------------------------------+
316-
| | In general, *t1* \* i == *t1* \* (i-1) + *t1* |
317+
| | In general, ``t1 * i == t1 * (i-1) + t1`` |
317318
| | is true. (1) |
318319
+--------------------------------+-----------------------------------------------+
319320
| ``t1 = t2 * f or t1 = f * t2`` | Delta multiplied by a float. The result is |
320321
| | rounded to the nearest multiple of |
321322
| | timedelta.resolution using round-half-to-even.|
322323
+--------------------------------+-----------------------------------------------+
323-
| ``f = t2 / t3`` | Division (3) of overall duration *t2* by |
324-
| | interval unit *t3*. Returns a :class:`float` |
324+
| ``f = t2 / t3`` | Division (3) of overall duration ``t2`` by |
325+
| | interval unit ``t3``. Returns a :class:`float`|
325326
| | object. |
326327
+--------------------------------+-----------------------------------------------+
327328
| ``t1 = t2 / f or t1 = t2 / i`` | Delta divided by a float or an int. The result|
@@ -343,13 +344,12 @@ Supported operations:
343344
| ``+t1`` | Returns a :class:`timedelta` object with the |
344345
| | same value. (2) |
345346
+--------------------------------+-----------------------------------------------+
346-
| ``-t1`` | equivalent to |
347-
| | :class:`timedelta`\ (-*t1.days*, |
348-
| | -*t1.seconds*, -*t1.microseconds*), |
349-
| | and to *t1*\* -1. (1)(4) |
347+
| ``-t1`` | Equivalent to ``timedelta(-t1.days, |
348+
| | -t1.seconds*, -t1.microseconds)``, |
349+
| | and to ``t1 * -1``. (1)(4) |
350350
+--------------------------------+-----------------------------------------------+
351-
| ``abs(t)`` | equivalent to +\ *t* when ``t.days >= 0``, |
352-
| | and to -*t* when ``t.days < 0``. (2) |
351+
| ``abs(t)`` | Equivalent to ``+t`` when ``t.days >= 0``, |
352+
| | and to ``-t`` when ``t.days < 0``. (2) |
353353
+--------------------------------+-----------------------------------------------+
354354
| ``str(t)`` | Returns a string in the form |
355355
| | ``[D day[s], ][H]H:MM:SS[.UUUUUU]``, where D |
@@ -370,10 +370,10 @@ Notes:
370370
This is exact and cannot overflow.
371371

372372
(3)
373-
Division by 0 raises :exc:`ZeroDivisionError`.
373+
Division by zero raises :exc:`ZeroDivisionError`.
374374

375375
(4)
376-
-*timedelta.max* is not representable as a :class:`timedelta` object.
376+
``-timedelta.max`` is not representable as a :class:`timedelta` object.
377377

378378
(5)
379379
String representations of :class:`timedelta` objects are normalized
@@ -583,10 +583,10 @@ Supported operations:
583583
+-------------------------------+----------------------------------------------+
584584
| Operation | Result |
585585
+===============================+==============================================+
586-
| ``date2 = date1 + timedelta`` | *date2* will be ``timedelta.days`` days |
587-
| | after *date1*. (1) |
586+
| ``date2 = date1 + timedelta`` | ``date2`` will be ``timedelta.days`` days |
587+
| | after ``date1``. (1) |
588588
+-------------------------------+----------------------------------------------+
589-
| ``date2 = date1 - timedelta`` | Computes *date2* such that ``date2 + |
589+
| ``date2 = date1 - timedelta`` | Computes ``date2`` such that ``date2 + |
590590
| | timedelta == date1``. (2) |
591591
+-------------------------------+----------------------------------------------+
592592
| ``timedelta = date1 - date2`` | \(3) |
@@ -613,8 +613,8 @@ Notes:
613613
``timedelta.seconds`` and ``timedelta.microseconds`` are ignored.
614614

615615
(3)
616-
This is exact, and cannot overflow. timedelta.seconds and
617-
timedelta.microseconds are 0, and date2 + timedelta == date1 after.
616+
This is exact, and cannot overflow. ``timedelta.seconds`` and
617+
``timedelta.microseconds`` are 0, and ``date2 + timedelta == date1`` after.
618618

619619
(4)
620620
:class:`date` objects are equal if they represent the same date.
@@ -652,7 +652,7 @@ Instance methods:
652652
time.struct_time((d.year, d.month, d.day, 0, 0, 0, d.weekday(), yday, -1))
653653

654654
where ``yday = d.toordinal() - date(d.year, 1, 1).toordinal() + 1``
655-
is the day number within the current year starting with ``1`` for January 1st.
655+
is the day number within the current year starting with 1 for January 1st.
656656

657657

658658
.. method:: date.toordinal()
@@ -972,8 +972,8 @@ Other constructors, all class methods:
972972
.. classmethod:: datetime.fromordinal(ordinal)
973973

974974
Return the :class:`.datetime` corresponding to the proleptic Gregorian ordinal,
975-
where January 1 of year 1 has ordinal 1. :exc:`ValueError` is raised unless ``1
976-
<= ordinal <= datetime.max.toordinal()``. The hour, minute, second and
975+
where January 1 of year 1 has ordinal 1. :exc:`ValueError` is raised unless
976+
``1 <= ordinal <= datetime.max.toordinal()``. The hour, minute, second and
977977
microsecond of the result are all 0, and :attr:`.tzinfo` is ``None``.
978978

979979

@@ -1130,8 +1130,8 @@ Instance attributes (read-only):
11301130
In ``[0, 1]``. Used to disambiguate wall times during a repeated interval. (A
11311131
repeated interval occurs when clocks are rolled back at the end of daylight saving
11321132
time or when the UTC offset for the current zone is decreased for political reasons.)
1133-
The value 0 (1) represents the earlier (later) of the two moments with the same wall
1134-
time representation.
1133+
The values 0 and 1 represent, respectively, the earlier and later of the two
1134+
moments with the same wall time representation.
11351135

11361136
.. versionadded:: 3.6
11371137

@@ -1156,16 +1156,16 @@ Supported operations:
11561156
+---------------------------------------+--------------------------------+
11571157

11581158
(1)
1159-
datetime2 is a duration of timedelta removed from datetime1, moving forward in
1160-
time if ``timedelta.days`` > 0, or backward if ``timedelta.days`` < 0. The
1159+
``datetime2`` is a duration of ``timedelta`` removed from ``datetime1``, moving forward in
1160+
time if ``timedelta.days > 0``, or backward if ``timedelta.days < 0``. The
11611161
result has the same :attr:`~.datetime.tzinfo` attribute as the input datetime, and
1162-
datetime2 - datetime1 == timedelta after. :exc:`OverflowError` is raised if
1163-
datetime2.year would be smaller than :const:`MINYEAR` or larger than
1162+
``datetime2 - datetime1 == timedelta`` after. :exc:`OverflowError` is raised if
1163+
``datetime2.year`` would be smaller than :const:`MINYEAR` or larger than
11641164
:const:`MAXYEAR`. Note that no time zone adjustments are done even if the
11651165
input is an aware object.
11661166

11671167
(2)
1168-
Computes the datetime2 such that datetime2 + timedelta == datetime1. As for
1168+
Computes the ``datetime2`` such that ``datetime2 + timedelta == datetime1``. As for
11691169
addition, the result has the same :attr:`~.datetime.tzinfo` attribute as the input
11701170
datetime, and no time zone adjustments are done even if the input is aware.
11711171

@@ -1343,12 +1343,12 @@ Instance methods:
13431343
d.weekday(), yday, dst))
13441344

13451345
where ``yday = d.toordinal() - date(d.year, 1, 1).toordinal() + 1``
1346-
is the day number within the current year starting with ``1`` for January
1346+
is the day number within the current year starting with 1 for January
13471347
1st. The :attr:`~time.struct_time.tm_isdst` flag of the result is set according to the
13481348
:meth:`dst` method: :attr:`.tzinfo` is ``None`` or :meth:`dst` returns
13491349
``None``, :attr:`!tm_isdst` is set to ``-1``; else if :meth:`dst` returns a
1350-
non-zero value, :attr:`!tm_isdst` is set to ``1``; else :attr:`!tm_isdst` is
1351-
set to ``0``.
1350+
non-zero value, :attr:`!tm_isdst` is set to 1; else :attr:`!tm_isdst` is
1351+
set to 0.
13521352

13531353

13541354
.. method:: datetime.utctimetuple()
@@ -1360,7 +1360,7 @@ Instance methods:
13601360
If *d* is aware, *d* is normalized to UTC time, by subtracting
13611361
``d.utcoffset()``, and a :class:`time.struct_time` for the
13621362
normalized time is returned. :attr:`!tm_isdst` is forced to 0. Note
1363-
that an :exc:`OverflowError` may be raised if *d*.year was
1363+
that an :exc:`OverflowError` may be raised if ``d.year`` was
13641364
``MINYEAR`` or ``MAXYEAR`` and UTC adjustment spills over a year
13651365
boundary.
13661366

@@ -1691,7 +1691,7 @@ day, and subject to adjustment via a :class:`tzinfo` object.
16911691
* ``fold in [0, 1]``.
16921692

16931693
If an argument outside those ranges is given, :exc:`ValueError` is raised. All
1694-
default to ``0`` except *tzinfo*, which defaults to :const:`None`.
1694+
default to 0 except *tzinfo*, which defaults to :const:`None`.
16951695

16961696
Class attributes:
16971697

@@ -1746,8 +1746,8 @@ Instance attributes (read-only):
17461746
In ``[0, 1]``. Used to disambiguate wall times during a repeated interval. (A
17471747
repeated interval occurs when clocks are rolled back at the end of daylight saving
17481748
time or when the UTC offset for the current zone is decreased for political reasons.)
1749-
The value 0 (1) represents the earlier (later) of the two moments with the same wall
1750-
time representation.
1749+
The values 0 and 1 represent, respectively, the earlier and later of the two
1750+
moments with the same wall time representation.
17511751

17521752
.. versionadded:: 3.6
17531753

@@ -2036,7 +2036,7 @@ Examples of working with a :class:`.time` object::
20362036
``tz.utcoffset(dt) - tz.dst(dt)``
20372037

20382038
must return the same result for every :class:`.datetime` *dt* with ``dt.tzinfo ==
2039-
tz`` For sane :class:`tzinfo` subclasses, this expression yields the time
2039+
tz``. For sane :class:`tzinfo` subclasses, this expression yields the time
20402040
zone's "standard offset", which should not depend on the date or the time, but
20412041
only on geographic location. The implementation of :meth:`datetime.astimezone`
20422042
relies on this, but cannot detect violations; it's the programmer's
@@ -2073,7 +2073,7 @@ Examples of working with a :class:`.time` object::
20732073
Return the time zone name corresponding to the :class:`.datetime` object *dt*, as
20742074
a string. Nothing about string names is defined by the :mod:`!datetime` module,
20752075
and there's no requirement that it mean anything in particular. For example,
2076-
"GMT", "UTC", "-500", "-5:00", "EDT", "US/Eastern", "America/New York" are all
2076+
``"GMT"``, ``"UTC"``, ``"-500"``, ``"-5:00"``, ``"EDT"``, ``"US/Eastern"``, ``"America/New York"`` are all
20772077
valid replies. Return ``None`` if a string name isn't known. Note that this is
20782078
a method rather than a fixed string primarily because some :class:`tzinfo`
20792079
subclasses will wish to return different names depending on the specific value
@@ -2514,11 +2514,11 @@ information, which are supported in ``datetime.strptime`` but are discarded by
25142514

25152515
For :class:`.time` objects, the format codes for year, month, and day should not
25162516
be used, as :class:`!time` objects have no such values. If they're used anyway,
2517-
``1900`` is substituted for the year, and ``1`` for the month and day.
2517+
1900 is substituted for the year, and 1 for the month and day.
25182518

25192519
For :class:`date` objects, the format codes for hours, minutes, seconds, and
25202520
microseconds should not be used, as :class:`date` objects have no such
2521-
values. If they're used anyway, ``0`` is substituted for them.
2521+
values. If they're used anyway, 0 is substituted for them.
25222522

25232523
For the same reason, handling of format strings containing Unicode code points
25242524
that can't be represented in the charset of the current locale is also
@@ -2642,4 +2642,4 @@ Notes:
26422642
<https://web.archive.org/web/20220531051136/https://webspace.science.uu.nl/~gent0113/calendar/isocalendar.htm>`_
26432643
for a good explanation.
26442644
2645-
.. [#] Passing ``datetime.strptime('Feb 29', '%b %d')`` will fail since ``1900`` is not a leap year.
2645+
.. [#] Passing ``datetime.strptime('Feb 29', '%b %d')`` will fail since 1900 is not a leap year.

_sources/library/doctest.rst.txt

+3-3
Original file line numberDiff line numberDiff line change
@@ -800,18 +800,18 @@ guarantee about output. For example, when printing a set, Python doesn't
800800
guarantee that the element is printed in any particular order, so a test like ::
801801

802802
>>> foo()
803-
{"Hermione", "Harry"}
803+
{"spam", "eggs"}
804804

805805
is vulnerable! One workaround is to do ::
806806

807-
>>> foo() == {"Hermione", "Harry"}
807+
>>> foo() == {"spam", "eggs"}
808808
True
809809

810810
instead. Another is to do ::
811811

812812
>>> d = sorted(foo())
813813
>>> d
814-
['Harry', 'Hermione']
814+
['eggs', 'spam']
815815

816816
There are others, but you get the idea.
817817

0 commit comments

Comments
 (0)