Skip to content

Commit 482aa23

Browse files
committed
add python docs option.
1 parent c4937b3 commit 482aa23

File tree

509 files changed

+723460
-0
lines changed

Some content is hidden

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

509 files changed

+723460
-0
lines changed

data/python_docs/input.txt

Lines changed: 361721 additions & 0 deletions
Large diffs are not rendered by default.

data/python_docs/merge.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
""" Merge the python docs into a single file."""
2+
3+
import os
4+
import pathlib
5+
6+
7+
if __name__ == '__main__':
8+
9+
with open("input.txt", "w") as write_to_input_file:
10+
for root, folder, docfiles in os.walk("./python-3.13-docs-text"):
11+
for docfile in docfiles:
12+
if docfile.split(".")[-1] == 'txt':
13+
path = pathlib.Path(f"{root}/{docfile}")
14+
with open(path, "r") as read_file:
15+
lines = read_file.readlines()
16+
write_to_input_file.writelines(lines)
17+
write_to_input_file.write(" ")
18+
19+
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
About this documentation
2+
************************
3+
4+
Python's documentation is generated from reStructuredText sources
5+
using Sphinx, a documentation generator originally created for Python
6+
and now maintained as an independent project.
7+
8+
Development of the documentation and its toolchain is an entirely
9+
volunteer effort, just like Python itself. If you want to contribute,
10+
please take a look at the Dealing with Bugs page for information on
11+
how to do so. New volunteers are always welcome!
12+
13+
Many thanks go to:
14+
15+
* Fred L. Drake, Jr., the creator of the original Python documentation
16+
toolset and author of much of the content;
17+
18+
* the Docutils project for creating reStructuredText and the Docutils
19+
suite;
20+
21+
* Fredrik Lundh for his Alternative Python Reference project from
22+
which Sphinx got many good ideas.
23+
24+
25+
Contributors to the Python documentation
26+
========================================
27+
28+
Many people have contributed to the Python language, the Python
29+
standard library, and the Python documentation. See Misc/ACKS in the
30+
Python source distribution for a partial list of contributors.
31+
32+
It is only with the input and contributions of the Python community
33+
that Python has such wonderful documentation -- Thank You!
Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
Dealing with Bugs
2+
*****************
3+
4+
Python is a mature programming language which has established a
5+
reputation for stability. In order to maintain this reputation, the
6+
developers would like to know of any deficiencies you find in Python.
7+
8+
It can be sometimes faster to fix bugs yourself and contribute patches
9+
to Python as it streamlines the process and involves less people.
10+
Learn how to contribute.
11+
12+
13+
Documentation bugs
14+
==================
15+
16+
If you find a bug in this documentation or would like to propose an
17+
improvement, please submit a bug report on the tracker. If you have a
18+
suggestion on how to fix it, include that as well.
19+
20+
You can also open a discussion item on our Documentation Discourse
21+
forum.
22+
23+
If you find a bug in the theme (HTML / CSS / JavaScript) of the
24+
documentation, please submit a bug report on the python-doc-theme bug
25+
tracker.
26+
27+
If you're short on time, you can also email documentation bug reports
28+
to [email protected] (behavioral bugs can be sent to python-
29+
[email protected]). 'docs@' is a mailing list run by volunteers; your
30+
request will be noticed, though it may take a while to be processed.
31+
32+
See also:
33+
34+
Documentation bugs
35+
A list of documentation bugs that have been submitted to the
36+
Python issue tracker.
37+
38+
Issue Tracking
39+
Overview of the process involved in reporting an improvement on
40+
the tracker.
41+
42+
Helping with Documentation
43+
Comprehensive guide for individuals that are interested in
44+
contributing to Python documentation.
45+
46+
Documentation Translations
47+
A list of GitHub pages for documentation translation and their
48+
primary contacts.
49+
50+
51+
Using the Python issue tracker
52+
==============================
53+
54+
Issue reports for Python itself should be submitted via the GitHub
55+
issues tracker (https://github.com/python/cpython/issues). The GitHub
56+
issues tracker offers a web form which allows pertinent information to
57+
be entered and submitted to the developers.
58+
59+
The first step in filing a report is to determine whether the problem
60+
has already been reported. The advantage in doing so, aside from
61+
saving the developers' time, is that you learn what has been done to
62+
fix it; it may be that the problem has already been fixed for the next
63+
release, or additional information is needed (in which case you are
64+
welcome to provide it if you can!). To do this, search the tracker
65+
using the search box at the top of the page.
66+
67+
If the problem you're reporting is not already in the list, log in to
68+
GitHub. If you don't already have a GitHub account, create a new
69+
account using the "Sign up" link. It is not possible to submit a bug
70+
report anonymously.
71+
72+
Being now logged in, you can submit an issue. Click on the "New issue"
73+
button in the top bar to report a new issue.
74+
75+
The submission form has two fields, "Title" and "Comment".
76+
77+
For the "Title" field, enter a *very* short description of the
78+
problem; fewer than ten words is good.
79+
80+
In the "Comment" field, describe the problem in detail, including what
81+
you expected to happen and what did happen. Be sure to include
82+
whether any extension modules were involved, and what hardware and
83+
software platform you were using (including version information as
84+
appropriate).
85+
86+
Each issue report will be reviewed by a developer who will determine
87+
what needs to be done to correct the problem. You will receive an
88+
update each time an action is taken on the issue.
89+
90+
See also:
91+
92+
How to Report Bugs Effectively
93+
Article which goes into some detail about how to create a useful
94+
bug report. This describes what kind of information is useful and
95+
why it is useful.
96+
97+
Bug Writing Guidelines
98+
Information about writing a good bug report. Some of this is
99+
specific to the Mozilla project, but describes general good
100+
practices.
101+
102+
103+
Getting started contributing to Python yourself
104+
===============================================
105+
106+
Beyond just reporting bugs that you find, you are also welcome to
107+
submit patches to fix them. You can find more information on how to
108+
get started patching Python in the Python Developer's Guide. If you
109+
have questions, the core-mentorship mailing list is a friendly place
110+
to get answers to any and all questions pertaining to the process of
111+
fixing issues in Python.
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
Abstract Objects Layer
2+
**********************
3+
4+
The functions in this chapter interact with Python objects regardless
5+
of their type, or with wide classes of object types (e.g. all
6+
numerical types, or all sequence types). When used on object types
7+
for which they do not apply, they will raise a Python exception.
8+
9+
It is not possible to use these functions on objects that are not
10+
properly initialized, such as a list object that has been created by
11+
"PyList_New()", but whose items have not been set to some non-"NULL"
12+
value yet.
13+
14+
* Object Protocol
15+
16+
* Call Protocol
17+
18+
* The *tp_call* Protocol
19+
20+
* The Vectorcall Protocol
21+
22+
* Recursion Control
23+
24+
* Vectorcall Support API
25+
26+
* Object Calling API
27+
28+
* Call Support API
29+
30+
* Number Protocol
31+
32+
* Sequence Protocol
33+
34+
* Mapping Protocol
35+
36+
* Iterator Protocol
37+
38+
* Buffer Protocol
39+
40+
* Buffer structure
41+
42+
* Buffer request types
43+
44+
* request-independent fields
45+
46+
* readonly, format
47+
48+
* shape, strides, suboffsets
49+
50+
* contiguity requests
51+
52+
* compound requests
53+
54+
* Complex arrays
55+
56+
* NumPy-style: shape and strides
57+
58+
* PIL-style: shape, strides and suboffsets
59+
60+
* Buffer-related functions
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
Allocating Objects on the Heap
2+
******************************
3+
4+
PyObject *_PyObject_New(PyTypeObject *type)
5+
*Return value: New reference.*
6+
7+
PyVarObject *_PyObject_NewVar(PyTypeObject *type, Py_ssize_t size)
8+
*Return value: New reference.*
9+
10+
PyObject *PyObject_Init(PyObject *op, PyTypeObject *type)
11+
*Return value: Borrowed reference.** Part of the Stable ABI.*
12+
13+
Initialize a newly allocated object *op* with its type and initial
14+
reference. Returns the initialized object. Other fields of the
15+
object are not affected.
16+
17+
PyVarObject *PyObject_InitVar(PyVarObject *op, PyTypeObject *type, Py_ssize_t size)
18+
*Return value: Borrowed reference.** Part of the Stable ABI.*
19+
20+
This does everything "PyObject_Init()" does, and also initializes
21+
the length information for a variable-size object.
22+
23+
PyObject_New(TYPE, typeobj)
24+
25+
Allocate a new Python object using the C structure type *TYPE* and
26+
the Python type object *typeobj* ("PyTypeObject*"). Fields not
27+
defined by the Python object header are not initialized. The caller
28+
will own the only reference to the object (i.e. its reference count
29+
will be one). The size of the memory allocation is determined from
30+
the "tp_basicsize" field of the type object.
31+
32+
PyObject_NewVar(TYPE, typeobj, size)
33+
34+
Allocate a new Python object using the C structure type *TYPE* and
35+
the Python type object *typeobj* ("PyTypeObject*"). Fields not
36+
defined by the Python object header are not initialized. The
37+
allocated memory allows for the *TYPE* structure plus *size*
38+
("Py_ssize_t") fields of the size given by the "tp_itemsize" field
39+
of *typeobj*. This is useful for implementing objects like tuples,
40+
which are able to determine their size at construction time.
41+
Embedding the array of fields into the same allocation decreases
42+
the number of allocations, improving the memory management
43+
efficiency.
44+
45+
void PyObject_Del(void *op)
46+
47+
Releases memory allocated to an object using "PyObject_New" or
48+
"PyObject_NewVar". This is normally called from the "tp_dealloc"
49+
handler specified in the object's type. The fields of the object
50+
should not be accessed after this call as the memory is no longer a
51+
valid Python object.
52+
53+
PyObject _Py_NoneStruct
54+
55+
Object which is visible in Python as "None". This should only be
56+
accessed using the "Py_None" macro, which evaluates to a pointer to
57+
this object.
58+
59+
See also:
60+
61+
"PyModule_Create()"
62+
To allocate and create extension modules.
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
API and ABI Versioning
2+
**********************
3+
4+
CPython exposes its version number in the following macros. Note that
5+
these correspond to the version code is **built** with, not
6+
necessarily the version used at **run time**.
7+
8+
See C API Stability for a discussion of API and ABI stability across
9+
versions.
10+
11+
PY_MAJOR_VERSION
12+
13+
The "3" in "3.4.1a2".
14+
15+
PY_MINOR_VERSION
16+
17+
The "4" in "3.4.1a2".
18+
19+
PY_MICRO_VERSION
20+
21+
The "1" in "3.4.1a2".
22+
23+
PY_RELEASE_LEVEL
24+
25+
The "a" in "3.4.1a2". This can be "0xA" for alpha, "0xB" for beta,
26+
"0xC" for release candidate or "0xF" for final.
27+
28+
PY_RELEASE_SERIAL
29+
30+
The "2" in "3.4.1a2". Zero for final releases.
31+
32+
PY_VERSION_HEX
33+
34+
The Python version number encoded in a single integer.
35+
36+
The underlying version information can be found by treating it as a
37+
32 bit number in the following manner:
38+
39+
+---------+---------------------------+---------------------------+----------------------------+
40+
| Bytes | Bits (big endian order) | Meaning | Value for "3.4.1a2" |
41+
|=========|===========================|===========================|============================|
42+
| 1 | 1-8 | "PY_MAJOR_VERSION" | "0x03" |
43+
+---------+---------------------------+---------------------------+----------------------------+
44+
| 2 | 9-16 | "PY_MINOR_VERSION" | "0x04" |
45+
+---------+---------------------------+---------------------------+----------------------------+
46+
| 3 | 17-24 | "PY_MICRO_VERSION" | "0x01" |
47+
+---------+---------------------------+---------------------------+----------------------------+
48+
| 4 | 25-28 | "PY_RELEASE_LEVEL" | "0xA" |
49+
| +---------------------------+---------------------------+----------------------------+
50+
| | 29-32 | "PY_RELEASE_SERIAL" | "0x2" |
51+
+---------+---------------------------+---------------------------+----------------------------+
52+
53+
Thus "3.4.1a2" is hexversion "0x030401a2" and "3.10.0" is
54+
hexversion "0x030a00f0".
55+
56+
Use this for numeric comparisons, e.g. "#if PY_VERSION_HEX >= ...".
57+
58+
This version is also available via the symbol "Py_Version".
59+
60+
const unsigned long Py_Version
61+
* Part of the Stable ABI since version 3.11.*
62+
63+
The Python runtime version number encoded in a single constant
64+
integer, with the same format as the "PY_VERSION_HEX" macro. This
65+
contains the Python version used at run time.
66+
67+
Added in version 3.11.
68+
69+
All the given macros are defined in Include/patchlevel.h.

0 commit comments

Comments
 (0)