Skip to content

Commit 91453cd

Browse files
authored
Merge branch 'master' into dependabot/pip/types-pyopenssl-22.1.0.2
2 parents a206298 + 52661f2 commit 91453cd

66 files changed

Lines changed: 682 additions & 285 deletions

Some content is hidden

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

docs-requirements.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ attrs==22.1.0
1212
# via
1313
# -r docs-requirements.in
1414
# outcome
15-
babel==2.10.3
15+
babel==2.11.0
1616
# via sphinx
1717
certifi==2022.9.24
1818
# via requests
@@ -28,7 +28,7 @@ docutils==0.17.1
2828
# via
2929
# sphinx
3030
# sphinx-rtd-theme
31-
exceptiongroup==1.0.1
31+
exceptiongroup==1.0.4
3232
# via -r docs-requirements.in
3333
idna==3.4
3434
# via
@@ -70,7 +70,7 @@ sphinx==3.3.1
7070
# -r docs-requirements.in
7171
# sphinx-rtd-theme
7272
# sphinxcontrib-trio
73-
sphinx-rtd-theme==1.0.0
73+
sphinx-rtd-theme==1.1.1
7474
# via -r docs-requirements.in
7575
sphinxcontrib-applehelp==1.0.2
7676
# via sphinx
@@ -90,7 +90,7 @@ tomli==2.0.1
9090
# via towncrier
9191
towncrier==22.8.0
9292
# via -r docs-requirements.in
93-
urllib3==1.26.12
93+
urllib3==1.26.13
9494
# via requests
9595

9696
# The following packages are considered to be unsafe in a requirements file:

docs/source/conf.py

Lines changed: 41 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#!/usr/bin/env python3
2-
# -*- coding: utf-8 -*-
32
#
43
# Trio documentation build configuration file, created by
54
# sphinx-quickstart on Sat Jan 21 19:11:14 2017.
@@ -19,17 +18,20 @@
1918
#
2019
import os
2120
import sys
21+
2222
# For our local_customization module
23-
sys.path.insert(0, os.path.abspath('.'))
23+
sys.path.insert(0, os.path.abspath("."))
2424
# For trio itself
25-
sys.path.insert(0, os.path.abspath('../..'))
25+
sys.path.insert(0, os.path.abspath("../.."))
2626

2727
# https://docs.readthedocs.io/en/stable/builds.html#build-environment
2828
if "READTHEDOCS" in os.environ:
2929
import glob
30+
3031
if glob.glob("../../newsfragments/*.*.rst"):
3132
print("-- Found newsfragments; running towncrier --", flush=True)
3233
import subprocess
34+
3335
subprocess.run(
3436
["towncrier", "--yes", "--date", "not released yet"],
3537
cwd="../..",
@@ -66,6 +68,7 @@
6668
def setup(app):
6769
app.add_css_file("hackrtd.css")
6870

71+
6972
# -- General configuration ------------------------------------------------
7073

7174
# If your documentation needs a minimal Sphinx version, state it here.
@@ -76,46 +79,46 @@ def setup(app):
7679
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
7780
# ones.
7881
extensions = [
79-
'sphinx.ext.autodoc',
80-
'sphinx.ext.intersphinx',
81-
'sphinx.ext.coverage',
82-
'sphinx.ext.napoleon',
83-
'sphinxcontrib_trio',
84-
'local_customization',
82+
"sphinx.ext.autodoc",
83+
"sphinx.ext.intersphinx",
84+
"sphinx.ext.coverage",
85+
"sphinx.ext.napoleon",
86+
"sphinxcontrib_trio",
87+
"local_customization",
8588
]
8689

87-
# FIXME: change the "python" link back to /3 when Python 3.11 is released
8890
intersphinx_mapping = {
89-
"python": ('https://docs.python.org/3.11', None),
90-
"outcome": ('https://outcome.readthedocs.io/en/latest/', None),
91-
"pyopenssl": ('https://www.pyopenssl.org/en/stable/', None),
91+
"python": ("https://docs.python.org/3", None),
92+
"outcome": ("https://outcome.readthedocs.io/en/latest/", None),
93+
"pyopenssl": ("https://www.pyopenssl.org/en/stable/", None),
9294
}
9395

9496
autodoc_member_order = "bysource"
9597

9698
# Add any paths that contain templates here, relative to this directory.
97-
templates_path = ['_templates']
99+
templates_path = ["_templates"]
98100

99101
# The suffix(es) of source filenames.
100102
# You can specify multiple suffix as a list of string:
101103
#
102104
# source_suffix = ['.rst', '.md']
103-
source_suffix = '.rst'
105+
source_suffix = ".rst"
104106

105107
# The master toctree document.
106-
master_doc = 'index'
108+
master_doc = "index"
107109

108110
# General information about the project.
109-
project = 'Trio'
110-
copyright = '2017, Nathaniel J. Smith'
111-
author = 'Nathaniel J. Smith'
111+
project = "Trio"
112+
copyright = "2017, Nathaniel J. Smith"
113+
author = "Nathaniel J. Smith"
112114

113115
# The version info for the project you're documenting, acts as replacement for
114116
# |version| and |release|, also used in various other places throughout the
115117
# built documents.
116118
#
117119
# The short X.Y version.
118120
import trio
121+
119122
version = trio.__version__
120123
# The full version, including alpha/beta/rc tags.
121124
release = version
@@ -137,9 +140,9 @@ def setup(app):
137140
exclude_patterns = []
138141

139142
# The name of the Pygments (syntax highlighting) style to use.
140-
pygments_style = 'default'
143+
pygments_style = "default"
141144

142-
highlight_language = 'python3'
145+
highlight_language = "python3"
143146

144147
# If true, `todo` and `todoList` produce output, else they produce nothing.
145148
todo_include_todos = False
@@ -154,13 +157,14 @@ def setup(app):
154157
# The theme to use for HTML and HTML Help pages. See the documentation for
155158
# a list of builtin themes.
156159
#
157-
#html_theme = 'alabaster'
160+
# html_theme = 'alabaster'
158161

159162
# We have to set this ourselves, not only because it's useful for local
160163
# testing, but also because if we don't then RTD will throw away our
161164
# html_theme_options.
162165
import sphinx_rtd_theme
163-
html_theme = 'sphinx_rtd_theme'
166+
167+
html_theme = "sphinx_rtd_theme"
164168
html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
165169

166170
# Theme options are theme-specific and customize the look and feel of a theme
@@ -175,19 +179,19 @@ def setup(app):
175179
# versions/settings...
176180
"navigation_depth": 4,
177181
"logo_only": True,
178-
'prev_next_buttons_location': 'both'
182+
"prev_next_buttons_location": "both",
179183
}
180184

181185
# Add any paths that contain custom static files (such as style sheets) here,
182186
# relative to this directory. They are copied after the builtin static files,
183187
# so a file named "default.css" will overwrite the builtin "default.css".
184-
html_static_path = ['_static']
188+
html_static_path = ["_static"]
185189

186190

187191
# -- Options for HTMLHelp output ------------------------------------------
188192

189193
# Output file base name for HTML help builder.
190-
htmlhelp_basename = 'Triodoc'
194+
htmlhelp_basename = "Triodoc"
191195

192196

193197
# -- Options for LaTeX output ---------------------------------------------
@@ -196,15 +200,12 @@ def setup(app):
196200
# The paper size ('letterpaper' or 'a4paper').
197201
#
198202
# 'papersize': 'letterpaper',
199-
200203
# The font size ('10pt', '11pt' or '12pt').
201204
#
202205
# 'pointsize': '10pt',
203-
204206
# Additional stuff for the LaTeX preamble.
205207
#
206208
# 'preamble': '',
207-
208209
# Latex figure (float) alignment
209210
#
210211
# 'figure_align': 'htbp',
@@ -214,19 +215,15 @@ def setup(app):
214215
# (source start file, target name, title,
215216
# author, documentclass [howto, manual, or own class]).
216217
latex_documents = [
217-
(master_doc, 'Trio.tex', 'Trio Documentation',
218-
'Nathaniel J. Smith', 'manual'),
218+
(master_doc, "Trio.tex", "Trio Documentation", "Nathaniel J. Smith", "manual"),
219219
]
220220

221221

222222
# -- Options for manual page output ---------------------------------------
223223

224224
# One entry per manual page. List of tuples
225225
# (source start file, name, description, authors, manual section).
226-
man_pages = [
227-
(master_doc, 'trio', 'Trio Documentation',
228-
[author], 1)
229-
]
226+
man_pages = [(master_doc, "trio", "Trio Documentation", [author], 1)]
230227

231228

232229
# -- Options for Texinfo output -------------------------------------------
@@ -235,7 +232,13 @@ def setup(app):
235232
# (source start file, target name, title, author,
236233
# dir menu entry, description, category)
237234
texinfo_documents = [
238-
(master_doc, 'Trio', 'Trio Documentation',
239-
author, 'Trio', 'One line description of project.',
240-
'Miscellaneous'),
235+
(
236+
master_doc,
237+
"Trio",
238+
"Trio Documentation",
239+
author,
240+
"Trio",
241+
"One line description of project.",
242+
"Miscellaneous",
243+
),
241244
]

docs/source/local_customization.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@
22
from sphinx import addnodes
33
from sphinx.domains.python import PyClasslike
44
from sphinx.ext.autodoc import (
5-
FunctionDocumenter, MethodDocumenter, ClassLevelDocumenter, Options,
5+
FunctionDocumenter,
6+
MethodDocumenter,
7+
ClassLevelDocumenter,
8+
Options,
69
)
710

811
"""
@@ -13,13 +16,15 @@
1316
1417
"""
1518

19+
1620
class Interface(PyClasslike):
1721
def handle_signature(self, sig, signode):
1822
signode += addnodes.desc_name(sig, sig)
1923
return sig, ""
2024

2125
def get_index_text(self, modname, name_cls):
22-
return "{} (interface in {})".format(name_cls[0], modname)
26+
return f"{name_cls[0]} (interface in {modname})"
27+
2328

2429
def setup(app):
2530
app.add_directive_to_domain("py", "interface", Interface)

docs/source/reference-core/channels-backpressure.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import trio
55
import math
66

7+
78
async def producer(send_channel):
89
count = 0
910
while True:
@@ -14,17 +15,20 @@ async def producer(send_channel):
1415
print("Sent message:", count)
1516
count += 1
1617

18+
1719
async def consumer(receive_channel):
1820
async for value in receive_channel:
1921
print("Received message:", value)
2022
# Pretend that we have to do some work to handle this message, and it
2123
# takes 1 second
2224
await trio.sleep(1)
2325

26+
2427
async def main():
2528
send_channel, receive_channel = trio.open_memory_channel(math.inf)
2629
async with trio.open_nursery() as nursery:
2730
nursery.start_soon(producer, send_channel)
2831
nursery.start_soon(consumer, receive_channel)
2932

33+
3034
trio.run(main)

docs/source/reference-core/channels-mpmc-broken.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import trio
44
import random
55

6+
67
async def main():
78
async with trio.open_nursery() as nursery:
89
send_channel, receive_channel = trio.open_memory_channel(0)
@@ -13,18 +14,21 @@ async def main():
1314
nursery.start_soon(consumer, "X", receive_channel)
1415
nursery.start_soon(consumer, "Y", receive_channel)
1516

17+
1618
async def producer(name, send_channel):
1719
async with send_channel:
1820
for i in range(3):
1921
await send_channel.send(f"{i} from producer {name}")
2022
# Random sleeps help trigger the problem more reliably
2123
await trio.sleep(random.random())
2224

25+
2326
async def consumer(name, receive_channel):
2427
async with receive_channel:
2528
async for value in receive_channel:
2629
print(f"consumer {name} got value {value!r}")
2730
# Random sleeps help trigger the problem more reliably
2831
await trio.sleep(random.random())
2932

33+
3034
trio.run(main)

docs/source/reference-core/channels-mpmc-fixed.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import trio
22
import random
33

4+
45
async def main():
56
async with trio.open_nursery() as nursery:
67
send_channel, receive_channel = trio.open_memory_channel(0)
@@ -12,18 +13,21 @@ async def main():
1213
nursery.start_soon(consumer, "X", receive_channel.clone())
1314
nursery.start_soon(consumer, "Y", receive_channel.clone())
1415

16+
1517
async def producer(name, send_channel):
1618
async with send_channel:
1719
for i in range(3):
1820
await send_channel.send(f"{i} from producer {name}")
1921
# Random sleeps help trigger the problem more reliably
2022
await trio.sleep(random.random())
2123

24+
2225
async def consumer(name, receive_channel):
2326
async with receive_channel:
2427
async for value in receive_channel:
2528
print(f"consumer {name} got value {value!r}")
2629
# Random sleeps help trigger the problem more reliably
2730
await trio.sleep(random.random())
2831

32+
2933
trio.run(main)
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,23 @@
11
import trio
22

3+
34
async def main():
45
async with trio.open_nursery() as nursery:
56
send_channel, receive_channel = trio.open_memory_channel(0)
67
nursery.start_soon(producer, send_channel)
78
nursery.start_soon(consumer, receive_channel)
89

10+
911
async def producer(send_channel):
1012
async with send_channel:
1113
for i in range(3):
1214
await send_channel.send(f"message {i}")
1315

16+
1417
async def consumer(receive_channel):
1518
async with receive_channel:
1619
async for value in receive_channel:
1720
print(f"got value {value!r}")
1821

22+
1923
trio.run(main)

0 commit comments

Comments
 (0)