Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 02d2b3b

Browse files
committed
Deploying to gh-pages from @ 5ee5eee 🚀
1 parent 2c2f940 commit 02d2b3b

File tree

530 files changed

+5550
-5505
lines changed

Some content is hidden

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

530 files changed

+5550
-5505
lines changed

‎_sources/library/dis.rst.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -528,7 +528,7 @@ not have to be) the original ``STACK[-2]``.
528528

529529
key = STACK.pop()
530530
container = STACK.pop()
531-
STACK.append(container[index])
531+
STACK.append(container[key])
532532

533533

534534
.. opcode:: STORE_SUBSCR

‎_sources/library/importlib.resources.abc.rst.txt

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,6 @@
4343
:const:`None`. An object compatible with this ABC should only be
4444
returned when the specified module is a package.
4545

46-
.. versionadded:: 3.7
47-
4846
.. deprecated-removed:: 3.12 3.14
4947
Use :class:`importlib.resources.abc.TraversableResources` instead.
5048

@@ -95,11 +93,6 @@
9593
For a representation of the object on the file-system, use
9694
:meth:`importlib.resources.as_file`.
9795

98-
.. versionadded:: 3.9
99-
100-
.. deprecated-removed:: 3.12 3.14
101-
Use :class:`importlib.resources.abc.Traversable` instead.
102-
10396
.. attribute:: name
10497

10598
Abstract. The base name of this object without any parent references.
@@ -153,11 +146,6 @@
153146
Loaders that wish to support resource reading are expected to
154147
implement this interface.
155148

156-
.. versionadded:: 3.9
157-
158-
.. deprecated-removed:: 3.12 3.14
159-
Use :class:`importlib.resources.abc.TraversableResources` instead.
160-
161149
.. abstractmethod:: files()
162150

163151
Returns a :class:`importlib.resources.abc.Traversable` object for the loaded

‎_sources/library/importlib.rst.txt

Lines changed: 154 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -645,6 +645,160 @@ ABC hierarchy::
645645
itself does not end in ``__init__``.
646646

647647

648+
.. class:: ResourceReader
649+
650+
*Superseded by TraversableResources*
651+
652+
An :term:`abstract base class` to provide the ability to read
653+
*resources*.
654+
655+
From the perspective of this ABC, a *resource* is a binary
656+
artifact that is shipped within a package. Typically this is
657+
something like a data file that lives next to the ``__init__.py``
658+
file of the package. The purpose of this class is to help abstract
659+
out the accessing of such data files so that it does not matter if
660+
the package and its data file(s) are stored in a e.g. zip file
661+
versus on the file system.
662+
663+
For any of methods of this class, a *resource* argument is
664+
expected to be a :term:`path-like object` which represents
665+
conceptually just a file name. This means that no subdirectory
666+
paths should be included in the *resource* argument. This is
667+
because the location of the package the reader is for, acts as the
668+
"directory". Hence the metaphor for directories and file
669+
names is packages and resources, respectively. This is also why
670+
instances of this class are expected to directly correlate to
671+
a specific package (instead of potentially representing multiple
672+
packages or a module).
673+
674+
Loaders that wish to support resource reading are expected to
675+
provide a method called ``get_resource_reader(fullname)`` which
676+
returns an object implementing this ABC's interface. If the module
677+
specified by fullname is not a package, this method should return
678+
:const:`None`. An object compatible with this ABC should only be
679+
returned when the specified module is a package.
680+
681+
.. versionadded:: 3.7
682+
683+
.. deprecated-removed:: 3.12 3.14
684+
Use :class:`importlib.resources.abc.TraversableResources` instead.
685+
686+
.. abstractmethod:: open_resource(resource)
687+
688+
Returns an opened, :term:`file-like object` for binary reading
689+
of the *resource*.
690+
691+
If the resource cannot be found, :exc:`FileNotFoundError` is
692+
raised.
693+
694+
.. abstractmethod:: resource_path(resource)
695+
696+
Returns the file system path to the *resource*.
697+
698+
If the resource does not concretely exist on the file system,
699+
raise :exc:`FileNotFoundError`.
700+
701+
.. abstractmethod:: is_resource(name)
702+
703+
Returns ``True`` if the named *name* is considered a resource.
704+
:exc:`FileNotFoundError` is raised if *name* does not exist.
705+
706+
.. abstractmethod:: contents()
707+
708+
Returns an :term:`iterable` of strings over the contents of
709+
the package. Do note that it is not required that all names
710+
returned by the iterator be actual resources, e.g. it is
711+
acceptable to return names for which :meth:`is_resource` would
712+
be false.
713+
714+
Allowing non-resource names to be returned is to allow for
715+
situations where how a package and its resources are stored
716+
are known a priori and the non-resource names would be useful.
717+
For instance, returning subdirectory names is allowed so that
718+
when it is known that the package and resources are stored on
719+
the file system then those subdirectory names can be used
720+
directly.
721+
722+
The abstract method returns an iterable of no items.
723+
724+
725+
.. class:: Traversable
726+
727+
An object with a subset of :class:`pathlib.Path` methods suitable for
728+
traversing directories and opening files.
729+
730+
For a representation of the object on the file-system, use
731+
:meth:`importlib.resources.as_file`.
732+
733+
.. versionadded:: 3.9
734+
735+
.. deprecated-removed:: 3.12 3.14
736+
Use :class:`importlib.resources.abc.Traversable` instead.
737+
738+
.. attribute:: name
739+
740+
Abstract. The base name of this object without any parent references.
741+
742+
.. abstractmethod:: iterdir()
743+
744+
Yield ``Traversable`` objects in ``self``.
745+
746+
.. abstractmethod:: is_dir()
747+
748+
Return ``True`` if ``self`` is a directory.
749+
750+
.. abstractmethod:: is_file()
751+
752+
Return ``True`` if ``self`` is a file.
753+
754+
.. abstractmethod:: joinpath(child)
755+
756+
Return Traversable child in ``self``.
757+
758+
.. abstractmethod:: __truediv__(child)
759+
760+
Return ``Traversable`` child in ``self``.
761+
762+
.. abstractmethod:: open(mode='r', *args, **kwargs)
763+
764+
*mode* may be 'r' or 'rb' to open as text or binary. Return a handle
765+
suitable for reading (same as :attr:`pathlib.Path.open`).
766+
767+
When opening as text, accepts encoding parameters such as those
768+
accepted by :attr:`io.TextIOWrapper`.
769+
770+
.. method:: read_bytes()
771+
772+
Read contents of ``self`` as bytes.
773+
774+
.. method:: read_text(encoding=None)
775+
776+
Read contents of ``self`` as text.
777+
778+
779+
.. class:: TraversableResources
780+
781+
An abstract base class for resource readers capable of serving
782+
the :meth:`importlib.resources.files` interface. Subclasses
783+
:class:`importlib.resources.abc.ResourceReader` and provides
784+
concrete implementations of the :class:`importlib.resources.abc.ResourceReader`'s
785+
abstract methods. Therefore, any loader supplying
786+
:class:`importlib.abc.TraversableResources` also supplies ResourceReader.
787+
788+
Loaders that wish to support resource reading are expected to
789+
implement this interface.
790+
791+
.. versionadded:: 3.9
792+
793+
.. deprecated-removed:: 3.12 3.14
794+
Use :class:`importlib.resources.abc.TraversableResources` instead.
795+
796+
.. abstractmethod:: files()
797+
798+
Returns a :class:`importlib.resources.abc.Traversable` object for the loaded
799+
package.
800+
801+
648802

649803
:mod:`importlib.machinery` -- Importers and path hooks
650804
------------------------------------------------------

‎_sources/library/itertools.rst.txt

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -877,6 +877,7 @@ which incur interpreter overhead.
877877
yield i
878878
else:
879879
# Fast path for sequences
880+
stop = len(iterable) if stop is None else stop
880881
i = start - 1
881882
try:
882883
while True:
@@ -1030,13 +1031,16 @@ The following recipes have a more mathematical flavor:
10301031
def sieve(n):
10311032
"Primes less than n."
10321033
# sieve(30) --> 2 3 5 7 11 13 17 19 23 29
1034+
if n > 2:
1035+
yield 2
1036+
start = 3
10331037
data = bytearray((0, 1)) * (n // 2)
1034-
data[:3] = 0, 0, 0
10351038
limit = math.isqrt(n) + 1
1036-
for p in compress(range(limit), data):
1039+
for p in iter_index(data, 1, start, limit):
1040+
yield from iter_index(data, 1, start, p*p)
10371041
data[p*p : n : p+p] = bytes(len(range(p*p, n, p+p)))
1038-
data[2] = 1
1039-
return iter_index(data, 1) if n > 2 else iter([])
1042+
start = p*p
1043+
yield from iter_index(data, 1, start)
10401044

10411045
def factor(n):
10421046
"Prime factors of n."
@@ -1344,6 +1348,16 @@ The following recipes have a more mathematical flavor:
13441348
Traceback (most recent call last):
13451349
...
13461350
ValueError
1351+
>>> # Verify that both paths can find identical NaN values
1352+
>>> x = float('NaN')
1353+
>>> y = float('NaN')
1354+
>>> list(iter_index([0, x, x, y, 0], x))
1355+
[1, 2]
1356+
>>> list(iter_index(iter([0, x, x, y, 0]), x))
1357+
[1, 2]
1358+
>>> # Test list input. Lists do not support None for the stop argument
1359+
>>> list(iter_index(list('AABCADEAF'), 'A'))
1360+
[0, 1, 4, 7]
13471361

13481362
>>> list(sieve(30))
13491363
[2, 3, 5, 7, 11, 13, 17, 19, 23, 29]

‎_sources/library/superseded.rst.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ backwards compatibility. They have been superseded by other modules.
99

1010

1111
.. toctree::
12+
:maxdepth: 1
1213

1314
aifc.rst
1415
audioop.rst

‎_sources/library/traceback.rst.txt

Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -139,11 +139,11 @@ The module defines the following functions:
139139

140140
Format the exception part of a traceback using an exception value such as
141141
given by ``sys.last_value``. The return value is a list of strings, each
142-
ending in a newline. Normally, the list contains a single string; however,
143-
for :exc:`SyntaxError` exceptions, it contains several lines that (when
144-
printed) display detailed information about where the syntax error occurred.
145-
The message indicating which exception occurred is the always last string in
146-
the list.
142+
ending in a newline. The list contains the exception's message, which is
143+
normally a single string; however, for :exc:`SyntaxError` exceptions, it
144+
contains several lines that (when printed) display detailed information
145+
about where the syntax error occurred. Following the message, the list
146+
contains the exception's :attr:`notes <BaseException.__notes__>`.
147147

148148
Since Python 3.10, instead of passing *value*, an exception object
149149
can be passed as the first argument. If *value* is provided, the first
@@ -153,6 +153,9 @@ The module defines the following functions:
153153
The *etype* parameter has been renamed to *exc* and is now
154154
positional-only.
155155

156+
.. versionchanged:: 3.11
157+
The returned list now includes any notes attached to the exception.
158+
156159

157160
.. function:: format_exception(exc, /[, value, tb], limit=None, chain=True)
158161

@@ -235,6 +238,12 @@ capture data for later printing in a lightweight fashion.
235238
group's exceptions array. The formatted output is truncated when either
236239
limit is exceeded.
237240

241+
.. versionchanged:: 3.10
242+
Added the *compact* parameter.
243+
244+
.. versionchanged:: 3.11
245+
Added the *max_group_width* and *max_group_depth* parameters.
246+
238247
.. attribute:: __cause__
239248

240249
A :class:`TracebackException` of the original ``__cause__``.
@@ -330,28 +339,21 @@ capture data for later printing in a lightweight fashion.
330339
some containing internal newlines. :func:`~traceback.print_exception`
331340
is a wrapper around this method which just prints the lines to a file.
332341

333-
The message indicating which exception occurred is always the last
334-
string in the output.
335-
336342
.. method:: format_exception_only()
337343

338344
Format the exception part of the traceback.
339345

340346
The return value is a generator of strings, each ending in a newline.
341347

342-
Normally, the generator emits a single string; however, for
343-
:exc:`SyntaxError` exceptions, it emits several lines that (when
344-
printed) display detailed information about where the syntax
345-
error occurred.
348+
The generator emits the exception's message followed by its notes
349+
(if it has any). The exception message is normally a single string;
350+
however, for :exc:`SyntaxError` exceptions, it consists of several
351+
lines that (when printed) display detailed information about where
352+
the syntax error occurred.
346353

347-
The message indicating which exception occurred is always the last
348-
string in the output.
354+
.. versionchanged:: 3.11
355+
The exception's notes are now included in the output.
349356

350-
.. versionchanged:: 3.10
351-
Added the *compact* parameter.
352-
353-
.. versionchanged:: 3.11
354-
Added the *max_group_width* and *max_group_depth* parameters.
355357

356358

357359
:class:`StackSummary` Objects

‎_sources/library/turtle.rst.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2329,7 +2329,7 @@ Public classes
23292329
.. class:: RawTurtle(canvas)
23302330
RawPen(canvas)
23312331

2332-
:param canvas: a :class:`tkinter.Canvas`, a :class:`ScrolledCanvas` or a
2332+
:param canvas: a :class:`!tkinter.Canvas`, a :class:`ScrolledCanvas` or a
23332333
:class:`TurtleScreen`
23342334

23352335
Create a turtle. The turtle has all methods described above as "methods of
@@ -2344,7 +2344,7 @@ Public classes
23442344

23452345
.. class:: TurtleScreen(cv)
23462346

2347-
:param cv: a :class:`tkinter.Canvas`
2347+
:param cv: a :class:`!tkinter.Canvas`
23482348

23492349
Provides screen oriented methods like :func:`bgcolor` etc. that are described
23502350
above.
@@ -2428,15 +2428,15 @@ instance if one is not already present.
24282428

24292429
``Turtle`` is a subclass of :class:`RawTurtle`, which *doesn't* automatically
24302430
create a drawing surface - a *canvas* will need to be provided or created for
2431-
it. The *canvas* can be a :class:`tkinter.Canvas`, :class:`ScrolledCanvas`
2431+
it. The *canvas* can be a :class:`!tkinter.Canvas`, :class:`ScrolledCanvas`
24322432
or :class:`TurtleScreen`.
24332433

24342434

24352435
:class:`TurtleScreen` is the basic drawing surface for a
24362436
turtle. :class:`Screen` is a subclass of ``TurtleScreen``, and
24372437
includes :ref:`some additional methods <screenspecific>` for managing its
24382438
appearance (including size and title) and behaviour. ``TurtleScreen``'s
2439-
constructor needs a :class:`tkinter.Canvas` or a
2439+
constructor needs a :class:`!tkinter.Canvas` or a
24402440
:class:`ScrolledCanvas` as an argument.
24412441

24422442
The functional interface for turtle graphics uses the various methods of

‎_sources/library/zipapp.rst.txt

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -281,12 +281,7 @@ The steps to create a standalone archive are as follows:
281281
file - if not, you can just list the dependencies manually on the pip command
282282
line).
283283

284-
3. Optionally, delete the ``.dist-info`` directories created by pip in the
285-
``myapp`` directory. These hold metadata for pip to manage the packages, and
286-
as you won't be making any further use of pip they aren't required -
287-
although it won't do any harm if you leave them.
288-
289-
4. Package the application using:
284+
3. Package the application using:
290285

291286
.. code-block:: shell-session
292287

0 commit comments

Comments
 (0)