Skip to content

Commit 79567cf

Browse files
committed
Deploying to gh-pages from @ 71bf192 🚀
1 parent 8d7d59c commit 79567cf

File tree

1,075 files changed

+891522
-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.

1,075 files changed

+891522
-0
lines changed

.buildinfo

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Sphinx build info version 1
2+
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done.
3+
config: cb10d30bafb08cf1c216562b1e263843
4+
tags: 645f666f9bcd5a90fca523b33c5a78b7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,175 @@
1+
from datetime import tzinfo, timedelta, datetime
2+
3+
ZERO = timedelta(0)
4+
HOUR = timedelta(hours=1)
5+
SECOND = timedelta(seconds=1)
6+
7+
# A class capturing the platform's idea of local time.
8+
# (May result in wrong values on historical times in
9+
# timezones where UTC offset and/or the DST rules had
10+
# changed in the past.)
11+
import time as _time
12+
13+
STDOFFSET = timedelta(seconds = -_time.timezone)
14+
if _time.daylight:
15+
DSTOFFSET = timedelta(seconds = -_time.altzone)
16+
else:
17+
DSTOFFSET = STDOFFSET
18+
19+
DSTDIFF = DSTOFFSET - STDOFFSET
20+
21+
class LocalTimezone(tzinfo):
22+
23+
def fromutc(self, dt):
24+
assert dt.tzinfo is self
25+
stamp = (dt - datetime(1970, 1, 1, tzinfo=self)) // SECOND
26+
args = _time.localtime(stamp)[:6]
27+
dst_diff = DSTDIFF // SECOND
28+
# Detect fold
29+
fold = (args == _time.localtime(stamp - dst_diff))
30+
return datetime(*args, microsecond=dt.microsecond,
31+
tzinfo=self, fold=fold)
32+
33+
def utcoffset(self, dt):
34+
if self._isdst(dt):
35+
return DSTOFFSET
36+
else:
37+
return STDOFFSET
38+
39+
def dst(self, dt):
40+
if self._isdst(dt):
41+
return DSTDIFF
42+
else:
43+
return ZERO
44+
45+
def tzname(self, dt):
46+
return _time.tzname[self._isdst(dt)]
47+
48+
def _isdst(self, dt):
49+
tt = (dt.year, dt.month, dt.day,
50+
dt.hour, dt.minute, dt.second,
51+
dt.weekday(), 0, 0)
52+
stamp = _time.mktime(tt)
53+
tt = _time.localtime(stamp)
54+
return tt.tm_isdst > 0
55+
56+
Local = LocalTimezone()
57+
58+
59+
# A complete implementation of current DST rules for major US time zones.
60+
61+
def first_sunday_on_or_after(dt):
62+
days_to_go = 6 - dt.weekday()
63+
if days_to_go:
64+
dt += timedelta(days_to_go)
65+
return dt
66+
67+
68+
# US DST Rules
69+
#
70+
# This is a simplified (i.e., wrong for a few cases) set of rules for US
71+
# DST start and end times. For a complete and up-to-date set of DST rules
72+
# and timezone definitions, visit the Olson Database (or try pytz):
73+
# http://www.twinsun.com/tz/tz-link.htm
74+
# https://sourceforge.net/projects/pytz/ (might not be up-to-date)
75+
#
76+
# In the US, since 2007, DST starts at 2am (standard time) on the second
77+
# Sunday in March, which is the first Sunday on or after Mar 8.
78+
DSTSTART_2007 = datetime(1, 3, 8, 2)
79+
# and ends at 2am (DST time) on the first Sunday of Nov.
80+
DSTEND_2007 = datetime(1, 11, 1, 2)
81+
# From 1987 to 2006, DST used to start at 2am (standard time) on the first
82+
# Sunday in April and to end at 2am (DST time) on the last
83+
# Sunday of October, which is the first Sunday on or after Oct 25.
84+
DSTSTART_1987_2006 = datetime(1, 4, 1, 2)
85+
DSTEND_1987_2006 = datetime(1, 10, 25, 2)
86+
# From 1967 to 1986, DST used to start at 2am (standard time) on the last
87+
# Sunday in April (the one on or after April 24) and to end at 2am (DST time)
88+
# on the last Sunday of October, which is the first Sunday
89+
# on or after Oct 25.
90+
DSTSTART_1967_1986 = datetime(1, 4, 24, 2)
91+
DSTEND_1967_1986 = DSTEND_1987_2006
92+
93+
def us_dst_range(year):
94+
# Find start and end times for US DST. For years before 1967, return
95+
# start = end for no DST.
96+
if 2006 < year:
97+
dststart, dstend = DSTSTART_2007, DSTEND_2007
98+
elif 1986 < year < 2007:
99+
dststart, dstend = DSTSTART_1987_2006, DSTEND_1987_2006
100+
elif 1966 < year < 1987:
101+
dststart, dstend = DSTSTART_1967_1986, DSTEND_1967_1986
102+
else:
103+
return (datetime(year, 1, 1), ) * 2
104+
105+
start = first_sunday_on_or_after(dststart.replace(year=year))
106+
end = first_sunday_on_or_after(dstend.replace(year=year))
107+
return start, end
108+
109+
110+
class USTimeZone(tzinfo):
111+
112+
def __init__(self, hours, reprname, stdname, dstname):
113+
self.stdoffset = timedelta(hours=hours)
114+
self.reprname = reprname
115+
self.stdname = stdname
116+
self.dstname = dstname
117+
118+
def __repr__(self):
119+
return self.reprname
120+
121+
def tzname(self, dt):
122+
if self.dst(dt):
123+
return self.dstname
124+
else:
125+
return self.stdname
126+
127+
def utcoffset(self, dt):
128+
return self.stdoffset + self.dst(dt)
129+
130+
def dst(self, dt):
131+
if dt is None or dt.tzinfo is None:
132+
# An exception may be sensible here, in one or both cases.
133+
# It depends on how you want to treat them. The default
134+
# fromutc() implementation (called by the default astimezone()
135+
# implementation) passes a datetime with dt.tzinfo is self.
136+
return ZERO
137+
assert dt.tzinfo is self
138+
start, end = us_dst_range(dt.year)
139+
# Can't compare naive to aware objects, so strip the timezone from
140+
# dt first.
141+
dt = dt.replace(tzinfo=None)
142+
if start + HOUR <= dt < end - HOUR:
143+
# DST is in effect.
144+
return HOUR
145+
if end - HOUR <= dt < end:
146+
# Fold (an ambiguous hour): use dt.fold to disambiguate.
147+
return ZERO if dt.fold else HOUR
148+
if start <= dt < start + HOUR:
149+
# Gap (a non-existent hour): reverse the fold rule.
150+
return HOUR if dt.fold else ZERO
151+
# DST is off.
152+
return ZERO
153+
154+
def fromutc(self, dt):
155+
assert dt.tzinfo is self
156+
start, end = us_dst_range(dt.year)
157+
start = start.replace(tzinfo=self)
158+
end = end.replace(tzinfo=self)
159+
std_time = dt + self.stdoffset
160+
dst_time = std_time + HOUR
161+
if end <= dst_time < end + HOUR:
162+
# Repeated hour
163+
return std_time.replace(fold=1)
164+
if std_time < start or dst_time >= end:
165+
# Standard time
166+
return std_time
167+
if start <= std_time < end - HOUR:
168+
# Daylight saving time
169+
return dst_time
170+
171+
172+
Eastern = USTimeZone(-5, "Eastern", "EST", "EDT")
173+
Central = USTimeZone(-6, "Central", "CST", "CDT")
174+
Mountain = USTimeZone(-7, "Mountain", "MST", "MDT")
175+
Pacific = USTimeZone(-8, "Pacific", "PST", "PDT")

_images/hashlib-blake2-tree.png

10.8 KB
Loading

_images/logging_flow.png

21.4 KB
Loading

_images/pathlib-inheritance.png

6.28 KB
Loading

_images/tk_msg.png

14.6 KB
Loading

_images/turtle-star.png

33 KB
Loading

_images/win_installer.png

82.4 KB
Loading

_sources/about.rst.txt

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
=====================
2+
About these documents
3+
=====================
4+
5+
6+
These documents are generated from `reStructuredText`_ sources by `Sphinx`_, a
7+
document processor specifically written for the Python documentation.
8+
9+
.. _reStructuredText: https://docutils.sourceforge.io/rst.html
10+
.. _Sphinx: https://www.sphinx-doc.org/
11+
12+
.. In the online version of these documents, you can submit comments and suggest
13+
changes directly on the documentation pages.
14+
15+
Development of the documentation and its toolchain is an entirely volunteer
16+
effort, just like Python itself. If you want to contribute, please take a
17+
look at the :ref:`reporting-bugs` page for information on how to do so. New
18+
volunteers are always welcome!
19+
20+
Many thanks go to:
21+
22+
* Fred L. Drake, Jr., the creator of the original Python documentation toolset
23+
and writer of much of the content;
24+
* the `Docutils <https://docutils.sourceforge.io/>`_ project for creating
25+
reStructuredText and the Docutils suite;
26+
* Fredrik Lundh for his Alternative Python Reference project from which Sphinx
27+
got many good ideas.
28+
29+
30+
Contributors to the Python Documentation
31+
----------------------------------------
32+
33+
Many people have contributed to the Python language, the Python standard
34+
library, and the Python documentation. See :source:`Misc/ACKS` in the Python
35+
source distribution for a partial list of contributors.
36+
37+
It is only with the input and contributions of the Python community
38+
that Python has such wonderful documentation -- Thank You!

_sources/bugs.rst.txt

+105
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
.. _reporting-bugs:
2+
3+
*****************
4+
Dealing with Bugs
5+
*****************
6+
7+
Python is a mature programming language which has established a reputation for
8+
stability. In order to maintain this reputation, the developers would like to
9+
know of any deficiencies you find in Python.
10+
11+
It can be sometimes faster to fix bugs yourself and contribute patches to
12+
Python as it streamlines the process and involves less people. Learn how to
13+
:ref:`contribute <contributing-to-python>`.
14+
15+
Documentation bugs
16+
==================
17+
18+
If you find a bug in this documentation or would like to propose an improvement,
19+
please submit a bug report on the :ref:`tracker <using-the-tracker>`. If you
20+
have a suggestion on how to fix it, include that as well.
21+
22+
If you're short on time, you can also email documentation bug reports to
23+
[email protected] (behavioral bugs can be sent to [email protected]).
24+
'docs@' is a mailing list run by volunteers; your request will be noticed,
25+
though it may take a while to be processed.
26+
27+
.. seealso::
28+
29+
`Documentation bugs`_
30+
A list of documentation bugs that have been submitted to the Python issue tracker.
31+
32+
`Issue Tracking <https://devguide.python.org/tracker/>`_
33+
Overview of the process involved in reporting an improvement on the tracker.
34+
35+
`Helping with Documentation <https://devguide.python.org/docquality/#helping-with-documentation>`_
36+
Comprehensive guide for individuals that are interested in contributing to Python documentation.
37+
38+
`Documentation Translations <https://devguide.python.org/documenting/#translating>`_
39+
A list of GitHub pages for documentation translation and their primary contacts.
40+
41+
42+
.. _using-the-tracker:
43+
44+
Using the Python issue tracker
45+
==============================
46+
47+
Issue reports for Python itself should be submitted via the GitHub issues
48+
tracker (https://github.com/python/cpython/issues).
49+
The GitHub issues tracker offers a web form which allows pertinent information
50+
to be entered and submitted to the developers.
51+
52+
The first step in filing a report is to determine whether the problem has
53+
already been reported. The advantage in doing so, aside from saving the
54+
developers' time, is that you learn what has been done to fix it; it may be that
55+
the problem has already been fixed for the next release, or additional
56+
information is needed (in which case you are welcome to provide it if you can!).
57+
To do this, search the tracker using the search box at the top of the page.
58+
59+
If the problem you're reporting is not already in the list, log in to GitHub.
60+
If you don't already have a GitHub account, create a new account using the
61+
"Sign up" link.
62+
It is not possible to submit a bug report anonymously.
63+
64+
Being now logged in, you can submit an issue.
65+
Click on the "New issue" button in the top bar to report a new issue.
66+
67+
The submission form has two fields, "Title" and "Comment".
68+
69+
For the "Title" field, enter a *very* short description of the problem;
70+
less than ten words is good.
71+
72+
In the "Comment" field, describe the problem in detail, including what you
73+
expected to happen and what did happen. Be sure to include whether any
74+
extension modules were involved, and what hardware and software platform you
75+
were using (including version information as appropriate).
76+
77+
Each issue report will be reviewed by a developer who will determine what needs to
78+
be done to correct the problem. You will receive an update each time an action is
79+
taken on the issue.
80+
81+
82+
.. seealso::
83+
84+
`How to Report Bugs Effectively <https://www.chiark.greenend.org.uk/~sgtatham/bugs.html>`_
85+
Article which goes into some detail about how to create a useful bug report.
86+
This describes what kind of information is useful and why it is useful.
87+
88+
`Bug Writing Guidelines <https://bugzilla.mozilla.org/page.cgi?id=bug-writing.html>`_
89+
Information about writing a good bug report. Some of this is specific to the
90+
Mozilla project, but describes general good practices.
91+
92+
.. _contributing-to-python:
93+
94+
Getting started contributing to Python yourself
95+
===============================================
96+
97+
Beyond just reporting bugs that you find, you are also welcome to submit
98+
patches to fix them. You can find more information on how to get started
99+
patching Python in the `Python Developer's Guide`_. If you have questions,
100+
the `core-mentorship mailing list`_ is a friendly place to get answers to
101+
any and all questions pertaining to the process of fixing issues in Python.
102+
103+
.. _Documentation bugs: https://github.com/python/cpython/issues?q=is%3Aissue+is%3Aopen+label%3Adocs
104+
.. _Python Developer's Guide: https://devguide.python.org/
105+
.. _core-mentorship mailing list: https://mail.python.org/mailman3/lists/core-mentorship.python.org/

_sources/c-api/abstract.rst.txt

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
.. highlight:: c
2+
3+
.. _abstract:
4+
5+
**********************
6+
Abstract Objects Layer
7+
**********************
8+
9+
The functions in this chapter interact with Python objects regardless of their
10+
type, or with wide classes of object types (e.g. all numerical types, or all
11+
sequence types). When used on object types for which they do not apply, they
12+
will raise a Python exception.
13+
14+
It is not possible to use these functions on objects that are not properly
15+
initialized, such as a list object that has been created by :c:func:`PyList_New`,
16+
but whose items have not been set to some non-\ ``NULL`` value yet.
17+
18+
.. toctree::
19+
20+
object.rst
21+
call.rst
22+
number.rst
23+
sequence.rst
24+
mapping.rst
25+
iter.rst
26+
buffer.rst
27+
objbuffer.rst

0 commit comments

Comments
 (0)