Skip to content

Commit 630d981

Browse files
committed
Deploying to gh-pages from @ c9ce39d 🚀
1 parent c264b4b commit 630d981

File tree

547 files changed

+14796
-9958
lines changed

Some content is hidden

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

547 files changed

+14796
-9958
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: f3b2bb56e060a6a659708bf0595b9643
3+
config: 3171ec733aebb939b0562ca15f80c542
44
tags: 645f666f9bcd5a90fca523b33c5a78b7

_sources/howto/logging-cookbook.rst.txt

Lines changed: 64 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1915,14 +1915,15 @@ In a similar way to the above section, we can implement a listener and handler
19151915
using `pynng <https://pypi.org/project/pynng/>`_, which is a Python binding to
19161916
`NNG <https://nng.nanomsg.org/>`_, billed as a spiritual successor to ZeroMQ.
19171917
The following snippets illustrate -- you can test them in an environment which has
1918-
``pynng`` installed. Juat for variety, we present the listener first.
1918+
``pynng`` installed. Just for variety, we present the listener first.
19191919

19201920

19211921
Subclass ``QueueListener``
19221922
^^^^^^^^^^^^^^^^^^^^^^^^^^
19231923

19241924
.. code-block:: python
19251925
1926+
# listener.py
19261927
import json
19271928
import logging
19281929
import logging.handlers
@@ -1955,7 +1956,7 @@ Subclass ``QueueListener``
19551956
break
19561957
except pynng.Timeout:
19571958
pass
1958-
except pynng.Closed: # sometimes hit when you hit Ctrl-C
1959+
except pynng.Closed: # sometimes happens when you hit Ctrl-C
19591960
break
19601961
if data is None:
19611962
return None
@@ -1988,6 +1989,7 @@ Subclass ``QueueHandler``
19881989

19891990
.. code-block:: python
19901991
1992+
# sender.py
19911993
import json
19921994
import logging
19931995
import logging.handlers
@@ -2015,9 +2017,10 @@ Subclass ``QueueHandler``
20152017
20162018
logging.getLogger('pynng').propagate = False
20172019
handler = NNGSocketHandler(DEFAULT_ADDR)
2020+
# Make sure the process ID is in the output
20182021
logging.basicConfig(level=logging.DEBUG,
20192022
handlers=[logging.StreamHandler(), handler],
2020-
format='%(levelname)-8s %(name)10s %(message)s')
2023+
format='%(levelname)-8s %(name)10s %(process)6s %(message)s')
20212024
levels = (logging.DEBUG, logging.INFO, logging.WARNING, logging.ERROR,
20222025
logging.CRITICAL)
20232026
logger_names = ('myapp', 'myapp.lib1', 'myapp.lib2')
@@ -2031,7 +2034,64 @@ Subclass ``QueueHandler``
20312034
delay = random.random() * 2 + 0.5
20322035
time.sleep(delay)
20332036
2034-
You can run the above two snippets in separate command shells.
2037+
You can run the above two snippets in separate command shells. If we run the
2038+
listener in one shell and run the sender in two separate shells, we should see
2039+
something like the following. In the first sender shell:
2040+
2041+
.. code-block:: console
2042+
2043+
$ python sender.py
2044+
DEBUG myapp 613 Message no. 1
2045+
WARNING myapp.lib2 613 Message no. 2
2046+
CRITICAL myapp.lib2 613 Message no. 3
2047+
WARNING myapp.lib2 613 Message no. 4
2048+
CRITICAL myapp.lib1 613 Message no. 5
2049+
DEBUG myapp 613 Message no. 6
2050+
CRITICAL myapp.lib1 613 Message no. 7
2051+
INFO myapp.lib1 613 Message no. 8
2052+
(and so on)
2053+
2054+
In the second sender shell:
2055+
2056+
.. code-block:: console
2057+
2058+
$ python sender.py
2059+
INFO myapp.lib2 657 Message no. 1
2060+
CRITICAL myapp.lib2 657 Message no. 2
2061+
CRITICAL myapp 657 Message no. 3
2062+
CRITICAL myapp.lib1 657 Message no. 4
2063+
INFO myapp.lib1 657 Message no. 5
2064+
WARNING myapp.lib2 657 Message no. 6
2065+
CRITICAL myapp 657 Message no. 7
2066+
DEBUG myapp.lib1 657 Message no. 8
2067+
(and so on)
2068+
2069+
In the listener shell:
2070+
2071+
.. code-block:: console
2072+
2073+
$ python listener.py
2074+
Press Ctrl-C to stop.
2075+
DEBUG myapp 613 Message no. 1
2076+
WARNING myapp.lib2 613 Message no. 2
2077+
INFO myapp.lib2 657 Message no. 1
2078+
CRITICAL myapp.lib2 613 Message no. 3
2079+
CRITICAL myapp.lib2 657 Message no. 2
2080+
CRITICAL myapp 657 Message no. 3
2081+
WARNING myapp.lib2 613 Message no. 4
2082+
CRITICAL myapp.lib1 613 Message no. 5
2083+
CRITICAL myapp.lib1 657 Message no. 4
2084+
INFO myapp.lib1 657 Message no. 5
2085+
DEBUG myapp 613 Message no. 6
2086+
WARNING myapp.lib2 657 Message no. 6
2087+
CRITICAL myapp 657 Message no. 7
2088+
CRITICAL myapp.lib1 613 Message no. 7
2089+
INFO myapp.lib1 613 Message no. 8
2090+
DEBUG myapp.lib1 657 Message no. 8
2091+
(and so on)
2092+
2093+
As you can see, the logging from the two sender processes is interleaved in the
2094+
listener's output.
20352095

20362096

20372097
An example dictionary-based configuration

_sources/library/code.rst.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ build applications which provide an interactive interpreter prompt.
3636
instance of :class:`InteractiveConsole` and sets *readfunc* to be used as
3737
the :meth:`InteractiveConsole.raw_input` method, if provided. If *local* is
3838
provided, it is passed to the :class:`InteractiveConsole` constructor for
39-
use as the default namespace for the interpreter loop. The :meth:`interact`
39+
use as the default namespace for the interpreter loop. The :meth:`~InteractiveConsole.interact`
4040
method of the instance is then run with *banner* and *exitmsg* passed as the
4141
banner and exit message to use, if provided. The console object is discarded
4242
after use.

_sources/library/decimal.rst.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1517,7 +1517,7 @@ are also included in the pure Python version for compatibility.
15171517
the C version uses a thread-local rather than a coroutine-local context and the value
15181518
is ``False``. This is slightly faster in some nested context scenarios.
15191519

1520-
.. versionadded:: 3.8.3
1520+
.. versionadded:: 3.8.3
15211521

15221522

15231523
Rounding modes

_sources/library/glob.rst.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,10 @@ For example, ``'[?]'`` matches the character ``'?'``.
7777
Using the "``**``" pattern in large directory trees may consume
7878
an inordinate amount of time.
7979

80+
.. note::
81+
This function may return duplicate path names if *pathname*
82+
contains multiple "``**``" patterns and *recursive* is true.
83+
8084
.. versionchanged:: 3.5
8185
Support for recursive globs using "``**``".
8286

@@ -96,6 +100,10 @@ For example, ``'[?]'`` matches the character ``'?'``.
96100
.. audit-event:: glob.glob pathname,recursive glob.iglob
97101
.. audit-event:: glob.glob/2 pathname,recursive,root_dir,dir_fd glob.iglob
98102

103+
.. note::
104+
This function may return duplicate path names if *pathname*
105+
contains multiple "``**``" patterns and *recursive* is true.
106+
99107
.. versionchanged:: 3.5
100108
Support for recursive globs using "``**``".
101109

_sources/library/heapq.rst.txt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@ This module provides an implementation of the heap queue algorithm, also known
1717
as the priority queue algorithm.
1818

1919
Heaps are binary trees for which every parent node has a value less than or
20-
equal to any of its children. This implementation uses arrays for which
20+
equal to any of its children. We refer to this condition as the heap invariant.
21+
22+
This implementation uses arrays for which
2123
``heap[k] <= heap[2*k+1]`` and ``heap[k] <= heap[2*k+2]`` for all *k*, counting
2224
elements from zero. For the sake of comparison, non-existing elements are
2325
considered to be infinite. The interesting property of a heap is that its
@@ -319,4 +321,3 @@ applications, and I think it is good to keep a 'heap' module around. :-)
319321
backwards, and this was also used to avoid the rewinding time. Believe me, real
320322
good tape sorts were quite spectacular to watch! From all times, sorting has
321323
always been a Great Art! :-)
322-

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

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,13 +109,35 @@
109109

110110
Return True if self is a file.
111111

112-
.. abstractmethod:: joinpath(child)
112+
.. abstractmethod:: joinpath(*pathsegments)
113113

114-
Return Traversable child in self.
114+
Traverse directories according to *pathsegments* and return
115+
the result as :class:`!Traversable`.
116+
117+
Each *pathsegments* argument may contain multiple names separated by
118+
forward slashes (``/``, ``posixpath.sep`` ).
119+
For example, the following are equivalent::
120+
121+
files.joinpath('subdir', 'subsuddir', 'file.txt')
122+
files.joinpath('subdir/subsuddir/file.txt')
123+
124+
Note that some :class:`!Traversable` implementations
125+
might not be updated to the latest version of the protocol.
126+
For compatibility with such implementations, provide a single argument
127+
without path separators to each call to ``joinpath``. For example::
128+
129+
files.joinpath('subdir').joinpath('subsubdir').joinpath('file.txt')
130+
131+
.. versionchanged:: 3.11
132+
133+
``joinpath`` accepts multiple *pathsegments*, and these segments
134+
may contain forward slashes as path separators.
135+
Previously, only a single *child* argument was accepted.
115136

116137
.. abstractmethod:: __truediv__(child)
117138

118139
Return Traversable child in self.
140+
Equivalent to ``joinpath(child)``.
119141

120142
.. abstractmethod:: open(mode='r', *args, **kwargs)
121143

_sources/library/ipaddress.rst.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -292,14 +292,14 @@ write code that handles both IP versions correctly. Address objects are
292292
.. attribute:: is_multicast
293293
.. attribute:: is_private
294294
.. attribute:: is_global
295+
296+
.. versionadded:: 3.4
297+
295298
.. attribute:: is_unspecified
296299
.. attribute:: is_reserved
297300
.. attribute:: is_loopback
298301
.. attribute:: is_link_local
299302

300-
.. versionadded:: 3.4
301-
is_global
302-
303303
.. attribute:: is_site_local
304304

305305
``True`` if the address is reserved for site-local usage. Note that

_sources/library/logging.rst.txt

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -63,12 +63,13 @@ If you run *myapp.py*, you should see this in *myapp.log*:
6363
INFO:mylib:Doing something
6464
INFO:__main__:Finished
6565
66-
The key features of this idiomatic usage is that the majority of code is simply
66+
The key feature of this idiomatic usage is that the majority of code is simply
6767
creating a module level logger with ``getLogger(__name__)``, and using that
68-
logger to do any needed logging. This is concise while allowing downstream code
69-
fine grained control if needed. Logged messages to the module-level logger get
70-
forwarded up to handlers of loggers in higher-level modules, all the way up to
71-
the root logger; for this reason this approach is known as hierarchical logging.
68+
logger to do any needed logging. This is concise, while allowing downstream
69+
code fine-grained control if needed. Logged messages to the module-level logger
70+
get forwarded to handlers of loggers in higher-level modules, all the way up to
71+
the highest-level logger known as the root logger; this approach is known as
72+
hierarchical logging.
7273

7374
For logging to be useful, it needs to be configured: setting the levels and
7475
destinations for each logger, potentially changing how specific modules log,
@@ -82,8 +83,8 @@ The module provides a lot of functionality and flexibility. If you are
8283
unfamiliar with logging, the best way to get to grips with it is to view the
8384
tutorials (**see the links above and on the right**).
8485

85-
The basic classes defined by the module, together with their functions, are
86-
listed below.
86+
The basic classes defined by the module, together with their attributes and
87+
methods, are listed in the sections below.
8788

8889
* Loggers expose the interface that application code directly uses.
8990
* Handlers send the log records (created by loggers) to the appropriate

_sources/library/os.path.rst.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ the :mod:`glob` module.)
144144

145145
.. function:: lexists(path)
146146

147-
Return ``True`` if *path* refers to an existing path. Returns ``True`` for
147+
Return ``True`` if *path* refers to an existing path, including
148148
broken symbolic links. Equivalent to :func:`exists` on platforms lacking
149149
:func:`os.lstat`.
150150

0 commit comments

Comments
 (0)