Skip to content

Commit b0dba3b

Browse files
committed
Deploying to gh-pages from @ c3c12f9 🚀
1 parent 339bc0a commit b0dba3b

File tree

542 files changed

+3932
-3685
lines changed

Some content is hidden

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

542 files changed

+3932
-3685
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: a2b47628a88a67f77714d3b40da1802b
3+
config: 55018c9edc54c89ec7ab555bf1da68a0
44
tags: 645f666f9bcd5a90fca523b33c5a78b7

_sources/c-api/function.rst.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,15 +37,15 @@ There are a few functions specific to Python functions.
3737
The function's docstring and name are retrieved from the code object. *__module__*
3838
is retrieved from *globals*. The argument defaults, annotations and closure are
3939
set to ``NULL``. *__qualname__* is set to the same value as the code object's
40-
``co_qualname`` field.
40+
:attr:`~codeobject.co_qualname` field.
4141
4242
4343
.. c:function:: PyObject* PyFunction_NewWithQualName(PyObject *code, PyObject *globals, PyObject *qualname)
4444
4545
As :c:func:`PyFunction_New`, but also allows setting the function object's
4646
``__qualname__`` attribute. *qualname* should be a unicode object or ``NULL``;
4747
if ``NULL``, the ``__qualname__`` attribute is set to the same value as the
48-
code object's ``co_qualname`` field.
48+
code object's :attr:`~codeobject.co_qualname` field.
4949
5050
.. versionadded:: 3.3
5151

_sources/c-api/import.rst.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ Importing Modules
138138
:class:`~importlib.machinery.SourceFileLoader` otherwise.
139139
140140
The module's :attr:`__file__` attribute will be set to the code object's
141-
:attr:`!co_filename`. If applicable, :attr:`__cached__` will also
141+
:attr:`~codeobject.co_filename`. If applicable, :attr:`__cached__` will also
142142
be set.
143143
144144
This function will reload the module if it was already imported. See

_sources/c-api/typeobj.rst.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -343,13 +343,13 @@ slot typedefs
343343
| | :c:type:`PyTypeObject` * | |
344344
| | :c:type:`Py_ssize_t` | |
345345
+-----------------------------+-----------------------------+----------------------+
346-
| :c:type:`destructor` | void * | void |
346+
| :c:type:`destructor` | :c:type:`PyObject` * | void |
347347
+-----------------------------+-----------------------------+----------------------+
348348
| :c:type:`freefunc` | void * | void |
349349
+-----------------------------+-----------------------------+----------------------+
350350
| :c:type:`traverseproc` | .. line-block:: | int |
351351
| | | |
352-
| | void * | |
352+
| | :c:type:`PyObject` * | |
353353
| | :c:type:`visitproc` | |
354354
| | void * | |
355355
+-----------------------------+-----------------------------+----------------------+
@@ -426,7 +426,7 @@ slot typedefs
426426
| | :c:type:`PyObject` * | |
427427
| | :c:type:`Py_buffer` * | |
428428
+-----------------------------+-----------------------------+----------------------+
429-
| :c:type:`inquiry` | void * | int |
429+
| :c:type:`inquiry` | :c:type:`PyObject` * | int |
430430
+-----------------------------+-----------------------------+----------------------+
431431
| :c:type:`unaryfunc` | .. line-block:: | :c:type:`PyObject` * |
432432
| | | |

_sources/glossary.rst.txt

Lines changed: 26 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -160,9 +160,9 @@ Glossary
160160
A :term:`file object` able to read and write
161161
:term:`bytes-like objects <bytes-like object>`.
162162
Examples of binary files are files opened in binary mode (``'rb'``,
163-
``'wb'`` or ``'rb+'``), :data:`sys.stdin.buffer`,
164-
:data:`sys.stdout.buffer`, and instances of :class:`io.BytesIO` and
165-
:class:`gzip.GzipFile`.
163+
``'wb'`` or ``'rb+'``), :data:`sys.stdin.buffer <sys.stdin>`,
164+
:data:`sys.stdout.buffer <sys.stdout>`, and instances of
165+
:class:`io.BytesIO` and :class:`gzip.GzipFile`.
166166

167167
See also :term:`text file` for a file object able to read and write
168168
:class:`str` objects.
@@ -313,8 +313,9 @@ Glossary
313313
:ref:`class definitions <class>` for more about decorators.
314314

315315
descriptor
316-
Any object which defines the methods :meth:`__get__`, :meth:`__set__`, or
317-
:meth:`__delete__`. When a class attribute is a descriptor, its special
316+
Any object which defines the methods :meth:`~object.__get__`,
317+
:meth:`~object.__set__`, or :meth:`~object.__delete__`.
318+
When a class attribute is a descriptor, its special
318319
binding behavior is triggered upon attribute lookup. Normally, using
319320
*a.b* to get, set or delete an attribute looks up the object named *b* in
320321
the class dictionary for *a*, but if *b* is a descriptor, the respective
@@ -328,7 +329,8 @@ Glossary
328329

329330
dictionary
330331
An associative array, where arbitrary keys are mapped to values. The
331-
keys can be any object with :meth:`__hash__` and :meth:`__eq__` methods.
332+
keys can be any object with :meth:`~object.__hash__` and
333+
:meth:`~object.__eq__` methods.
332334
Called a hash in Perl.
333335

334336
dictionary comprehension
@@ -392,7 +394,7 @@ Glossary
392394

393395
file object
394396
An object exposing a file-oriented API (with methods such as
395-
:meth:`read()` or :meth:`write()`) to an underlying resource. Depending
397+
:meth:`!read` or :meth:`!write`) to an underlying resource. Depending
396398
on the way it was created, a file object can mediate access to a real
397399
on-disk file or to another type of storage or communication device
398400
(for example standard input/output, in-memory buffers, sockets, pipes,
@@ -568,8 +570,9 @@ Glossary
568570

569571
hashable
570572
An object is *hashable* if it has a hash value which never changes during
571-
its lifetime (it needs a :meth:`__hash__` method), and can be compared to
572-
other objects (it needs an :meth:`__eq__` method). Hashable objects which
573+
its lifetime (it needs a :meth:`~object.__hash__` method), and can be
574+
compared to other objects (it needs an :meth:`~object.__eq__` method).
575+
Hashable objects which
573576
compare equal must have the same hash value.
574577

575578
Hashability makes an object usable as a dictionary key and a set member,
@@ -645,7 +648,8 @@ Glossary
645648
iterables include all sequence types (such as :class:`list`, :class:`str`,
646649
and :class:`tuple`) and some non-sequence types like :class:`dict`,
647650
:term:`file objects <file object>`, and objects of any classes you define
648-
with an :meth:`__iter__` method or with a :meth:`~object.__getitem__` method
651+
with an :meth:`~iterator.__iter__` method or with a
652+
:meth:`~object.__getitem__` method
649653
that implements :term:`sequence` semantics.
650654

651655
Iterables can be
@@ -654,7 +658,7 @@ Glossary
654658
as an argument to the built-in function :func:`iter`, it returns an
655659
iterator for the object. This iterator is good for one pass over the set
656660
of values. When using iterables, it is usually not necessary to call
657-
:func:`iter` or deal with iterator objects yourself. The ``for``
661+
:func:`iter` or deal with iterator objects yourself. The :keyword:`for`
658662
statement does that automatically for you, creating a temporary unnamed
659663
variable to hold the iterator for the duration of the loop. See also
660664
:term:`iterator`, :term:`sequence`, and :term:`generator`.
@@ -665,8 +669,8 @@ Glossary
665669
:func:`next`) return successive items in the stream. When no more data
666670
are available a :exc:`StopIteration` exception is raised instead. At this
667671
point, the iterator object is exhausted and any further calls to its
668-
:meth:`__next__` method just raise :exc:`StopIteration` again. Iterators
669-
are required to have an :meth:`__iter__` method that returns the iterator
672+
:meth:`!__next__` method just raise :exc:`StopIteration` again. Iterators
673+
are required to have an :meth:`~iterator.__iter__` method that returns the iterator
670674
object itself so every iterator is also iterable and may be used in most
671675
places where other iterables are accepted. One notable exception is code
672676
which attempts multiple iteration passes. A container object (such as a
@@ -680,7 +684,7 @@ Glossary
680684
.. impl-detail::
681685

682686
CPython does not consistently apply the requirement that an iterator
683-
define :meth:`__iter__`.
687+
define :meth:`~iterator.__iter__`.
684688

685689
key function
686690
A key function or collation function is a callable that returns a value
@@ -874,7 +878,8 @@ Glossary
874878
Old name for the flavor of classes now used for all class objects. In
875879
earlier Python versions, only new-style classes could use Python's newer,
876880
versatile features like :attr:`~object.__slots__`, descriptors,
877-
properties, :meth:`__getattribute__`, class methods, and static methods.
881+
properties, :meth:`~object.__getattribute__`, class methods, and static
882+
methods.
878883

879884
object
880885
Any data with state (attributes or value) and defined behavior
@@ -954,7 +959,7 @@ Glossary
954959
finders implement.
955960

956961
path entry hook
957-
A callable on the :data:`sys.path_hook` list which returns a :term:`path
962+
A callable on the :data:`sys.path_hooks` list which returns a :term:`path
958963
entry finder` if it knows how to find modules on a specific :term:`path
959964
entry`.
960965

@@ -1088,18 +1093,18 @@ Glossary
10881093
sequence
10891094
An :term:`iterable` which supports efficient element access using integer
10901095
indices via the :meth:`~object.__getitem__` special method and defines a
1091-
:meth:`__len__` method that returns the length of the sequence.
1096+
:meth:`~object.__len__` method that returns the length of the sequence.
10921097
Some built-in sequence types are :class:`list`, :class:`str`,
10931098
:class:`tuple`, and :class:`bytes`. Note that :class:`dict` also
1094-
supports :meth:`~object.__getitem__` and :meth:`__len__`, but is considered a
1099+
supports :meth:`~object.__getitem__` and :meth:`!__len__`, but is considered a
10951100
mapping rather than a sequence because the lookups use arbitrary
10961101
:term:`immutable` keys rather than integers.
10971102

10981103
The :class:`collections.abc.Sequence` abstract base class
10991104
defines a much richer interface that goes beyond just
1100-
:meth:`~object.__getitem__` and :meth:`__len__`, adding :meth:`count`,
1101-
:meth:`index`, :meth:`__contains__`, and
1102-
:meth:`__reversed__`. Types that implement this expanded
1105+
:meth:`~object.__getitem__` and :meth:`~object.__len__`, adding
1106+
:meth:`count`, :meth:`index`, :meth:`~object.__contains__`, and
1107+
:meth:`~object.__reversed__`. Types that implement this expanded
11031108
interface can be registered explicitly using
11041109
:func:`~abc.ABCMeta.register`.
11051110

_sources/library/dis.rst.txt

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -324,8 +324,9 @@ operation is being performed, so the intermediate analysis object isn't useful:
324324
Line numbers can be decreasing. Before, they were always increasing.
325325

326326
.. versionchanged:: 3.10
327-
The :pep:`626` ``co_lines`` method is used instead of the ``co_firstlineno``
328-
and ``co_lnotab`` attributes of the code object.
327+
The :pep:`626` ``co_lines`` method is used instead of the
328+
:attr:`~codeobject.co_firstlineno` and :attr:`~codeobject.co_lnotab`
329+
attributes of the code object.
329330

330331

331332
.. function:: findlabels(code)
@@ -889,13 +890,13 @@ iterations of the loop.
889890
.. opcode:: STORE_NAME (namei)
890891

891892
Implements ``name = STACK.pop()``. *namei* is the index of *name* in the attribute
892-
:attr:`!co_names` of the :ref:`code object <code-objects>`.
893+
:attr:`~codeobject.co_names` of the :ref:`code object <code-objects>`.
893894
The compiler tries to use :opcode:`STORE_FAST` or :opcode:`STORE_GLOBAL` if possible.
894895

895896

896897
.. opcode:: DELETE_NAME (namei)
897898

898-
Implements ``del name``, where *namei* is the index into :attr:`!co_names`
899+
Implements ``del name``, where *namei* is the index into :attr:`~codeobject.co_names`
899900
attribute of the :ref:`code object <code-objects>`.
900901

901902

@@ -935,7 +936,7 @@ iterations of the loop.
935936
value = STACK.pop()
936937
obj.name = value
937938

938-
where *namei* is the index of name in :attr:`!co_names` of the
939+
where *namei* is the index of name in :attr:`~codeobject.co_names` of the
939940
:ref:`code object <code-objects>`.
940941

941942
.. opcode:: DELETE_ATTR (namei)
@@ -945,7 +946,7 @@ iterations of the loop.
945946
obj = STACK.pop()
946947
del obj.name
947948

948-
where *namei* is the index of name into :attr:`!co_names` of the
949+
where *namei* is the index of name into :attr:`~codeobject.co_names` of the
949950
:ref:`code object <code-objects>`.
950951

951952

@@ -1308,7 +1309,7 @@ iterations of the loop.
13081309
Pushes a reference to the object the cell contains on the stack.
13091310

13101311
.. versionchanged:: 3.11
1311-
``i`` is no longer offset by the length of ``co_varnames``.
1312+
``i`` is no longer offset by the length of :attr:`~codeobject.co_varnames`.
13121313

13131314

13141315
.. opcode:: LOAD_FROM_DICT_OR_DEREF (i)
@@ -1330,7 +1331,7 @@ iterations of the loop.
13301331
storage.
13311332

13321333
.. versionchanged:: 3.11
1333-
``i`` is no longer offset by the length of ``co_varnames``.
1334+
``i`` is no longer offset by the length of :attr:`~codeobject.co_varnames`.
13341335

13351336

13361337
.. opcode:: DELETE_DEREF (i)
@@ -1341,7 +1342,7 @@ iterations of the loop.
13411342
.. versionadded:: 3.2
13421343

13431344
.. versionchanged:: 3.11
1344-
``i`` is no longer offset by the length of ``co_varnames``.
1345+
``i`` is no longer offset by the length of :attr:`~codeobject.co_varnames`.
13451346

13461347

13471348
.. opcode:: COPY_FREE_VARS (n)

_sources/library/inspect.rst.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1579,8 +1579,8 @@ updated as expected:
15791579
Code Objects Bit Flags
15801580
----------------------
15811581

1582-
Python code objects have a ``co_flags`` attribute, which is a bitmap of
1583-
the following flags:
1582+
Python code objects have a :attr:`~codeobject.co_flags` attribute,
1583+
which is a bitmap of the following flags:
15841584

15851585
.. data:: CO_OPTIMIZED
15861586

_sources/library/reprlib.rst.txt

Lines changed: 30 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
--------------
1212

13-
The :mod:`reprlib` module provides a means for producing object representations
13+
The :mod:`!reprlib` module provides a means for producing object representations
1414
with limits on the size of the resulting strings. This is used in the Python
1515
debugger and may be useful in other contexts as well.
1616

@@ -58,29 +58,31 @@ This module provides a class, an instance, and a function:
5858
limits on most sizes.
5959

6060
In addition to size-limiting tools, the module also provides a decorator for
61-
detecting recursive calls to :meth:`__repr__` and substituting a placeholder
62-
string instead.
61+
detecting recursive calls to :meth:`~object.__repr__` and substituting a
62+
placeholder string instead.
6363

6464

6565
.. index:: single: ...; placeholder
6666

6767
.. decorator:: recursive_repr(fillvalue="...")
6868

69-
Decorator for :meth:`__repr__` methods to detect recursive calls within the
69+
Decorator for :meth:`~object.__repr__` methods to detect recursive calls within the
7070
same thread. If a recursive call is made, the *fillvalue* is returned,
71-
otherwise, the usual :meth:`__repr__` call is made. For example:
72-
73-
>>> from reprlib import recursive_repr
74-
>>> class MyList(list):
75-
... @recursive_repr()
76-
... def __repr__(self):
77-
... return '<' + '|'.join(map(repr, self)) + '>'
78-
...
79-
>>> m = MyList('abc')
80-
>>> m.append(m)
81-
>>> m.append('x')
82-
>>> print(m)
83-
<'a'|'b'|'c'|...|'x'>
71+
otherwise, the usual :meth:`!__repr__` call is made. For example:
72+
73+
.. doctest::
74+
75+
>>> from reprlib import recursive_repr
76+
>>> class MyList(list):
77+
... @recursive_repr()
78+
... def __repr__(self):
79+
... return '<' + '|'.join(map(repr, self)) + '>'
80+
...
81+
>>> m = MyList('abc')
82+
>>> m.append(m)
83+
>>> m.append('x')
84+
>>> print(m)
85+
<'a'|'b'|'c'|...|'x'>
8486

8587
.. versionadded:: 3.2
8688

@@ -148,10 +150,10 @@ which format specific object types.
148150
with no line breaks or indentation, like the standard :func:`repr`.
149151
For example:
150152

151-
.. code-block:: pycon
153+
.. doctest:: indent
152154

153155
>>> example = [
154-
1, 'spam', {'a': 2, 'b': 'spam eggs', 'c': {3: 4.5, 6: []}}, 'ham']
156+
... 1, 'spam', {'a': 2, 'b': 'spam eggs', 'c': {3: 4.5, 6: []}}, 'ham']
155157
>>> import reprlib
156158
>>> aRepr = reprlib.Repr()
157159
>>> print(aRepr.repr(example))
@@ -160,7 +162,7 @@ which format specific object types.
160162
If :attr:`~Repr.indent` is set to a string, each recursion level
161163
is placed on its own line, indented by that string:
162164

163-
.. code-block:: pycon
165+
.. doctest:: indent
164166

165167
>>> aRepr.indent = '-->'
166168
>>> print(aRepr.repr(example))
@@ -181,7 +183,7 @@ which format specific object types.
181183
Setting :attr:`~Repr.indent` to a positive integer value behaves as if it
182184
was set to a string with that number of spaces:
183185

184-
.. code-block:: pycon
186+
.. doctest:: indent
185187

186188
>>> aRepr.indent = 4
187189
>>> print(aRepr.repr(example))
@@ -234,7 +236,9 @@ Subclassing Repr Objects
234236
The use of dynamic dispatching by :meth:`Repr.repr1` allows subclasses of
235237
:class:`Repr` to add support for additional built-in object types or to modify
236238
the handling of types already supported. This example shows how special support
237-
for file objects could be added::
239+
for file objects could be added:
240+
241+
.. testcode::
238242

239243
import reprlib
240244
import sys
@@ -248,3 +252,7 @@ for file objects could be added::
248252

249253
aRepr = MyRepr()
250254
print(aRepr.repr(sys.stdin)) # prints '<stdin>'
255+
256+
.. testoutput::
257+
258+
<stdin>

0 commit comments

Comments
 (0)