Skip to content

Commit 2f5225c

Browse files
committed
YAPF me harder
1 parent 76a7d86 commit 2f5225c

7 files changed

Lines changed: 19 additions & 22 deletions

File tree

docs/source/conf.py

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
("py:class", "CapacityLimiter-like object"),
3131
("py:class", "bytes-like"),
3232
("py:class", "None"),
33-
3433
("py:func", "trio_asyncio.wait_for_child"),
3534
("py:func", "trio_asyncio.run_future"),
3635
("py:func", "trio_asyncio.run_coroutine"),
@@ -118,7 +117,6 @@
118117
# If true, `todo` and `todoList` produce output, else they produce nothing.
119118
todo_include_todos = False
120119

121-
122120
# -- Options for HTML output ----------------------------------------------
123121

124122
# The theme to use for HTML and HTML Help pages. See the documentation for
@@ -152,13 +150,11 @@
152150
# so a file named "default.css" will overwrite the builtin "default.css".
153151
html_static_path = ['_static']
154152

155-
156153
# -- Options for HTMLHelp output ------------------------------------------
157154

158155
# Output file base name for HTML help builder.
159156
htmlhelp_basename = 'trio-asyncio-doc'
160157

161-
162158
# -- Options for LaTeX output ---------------------------------------------
163159

164160
latex_elements = {
@@ -183,28 +179,23 @@
183179
# (source start file, target name, title,
184180
# author, documentclass [howto, manual, or own class]).
185181
latex_documents = [
186-
(master_doc, 'trio-asyncio.tex', 'Trio Documentation',
187-
author, 'manual'),
182+
(master_doc, 'trio-asyncio.tex', 'Trio Documentation', author, 'manual'),
188183
]
189184

190-
191185
# -- Options for manual page output ---------------------------------------
192186

193187
# One entry per manual page. List of tuples
194188
# (source start file, name, description, authors, manual section).
195-
man_pages = [
196-
(master_doc, 'trio-asyncio', 'trio-asyncio Documentation',
197-
[author], 1)
198-
]
199-
189+
man_pages = [(master_doc, 'trio-asyncio', 'trio-asyncio Documentation', [author], 1)]
200190

201191
# -- Options for Texinfo output -------------------------------------------
202192

203193
# Grouping the document tree into Texinfo files. List of tuples
204194
# (source start file, target name, title, author,
205195
# dir menu entry, description, category)
206196
texinfo_documents = [
207-
(master_doc, 'trio-asyncio', 'trio-asyncio Documentation',
208-
author, 'trio-asyncio', 'A re-implementation of the asyncio mainloop on top of Trio',
209-
'Miscellaneous'),
197+
(
198+
master_doc, 'trio-asyncio', 'trio-asyncio Documentation', author, 'trio-asyncio',
199+
'A re-implementation of the asyncio mainloop on top of Trio', 'Miscellaneous'
200+
),
210201
]

tests/conftest.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,4 +64,3 @@ async def loop():
6464
def pytest_pyfunc_call(pyfuncitem):
6565
if inspect.iscoroutinefunction(pyfuncitem.obj):
6666
pyfuncitem.obj = pytest.mark.trio(pyfuncitem.obj)
67-

tests/python/test_base_events.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ def chk(inf):
108108
assert inf[4][0] == '::3'
109109
assert inf[4][1] == 1
110110
assert len(inf) == 5
111-
assert len(inf[4]) in (2,4)
111+
assert len(inf[4]) in (2, 4)
112112

113113
chk(base_events._ipaddr_info('::3', 1, INET6, STREAM, TCP))
114114
chk(base_events._ipaddr_info('::3', 1, UNSPEC, STREAM, TCP))

tests/python/test_events.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2394,7 +2394,10 @@ def __await__(self):
23942394
# Some coroutines might not have '__name__', such as
23952395
# built-in async_gen.asend().
23962396

2397-
self.assertEqual(coroutines._format_coroutine(coro), 'Coro()' if sys.version_info < (3, 7) else '<Coro without __name__>()')
2397+
self.assertEqual(
2398+
coroutines._format_coroutine(coro), 'Coro()'
2399+
if sys.version_info < (3, 7) else '<Coro without __name__>()'
2400+
)
23982401

23992402

24002403
class TimerTests(unittest.TestCase):

tests/test_concurrent.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,15 +58,15 @@ def get_loop(i, loop, policy):
5858
assert isinstance(policy, trio_asyncio.TrioPolicy)
5959
async with trio_asyncio.open_loop() as loop2:
6060
p2 = asyncio.get_event_loop_policy()
61-
assert policy is p2, (policy,p2)
61+
assert policy is p2, (policy, p2)
6262
loop1.call_later(0.1, get_loop, 0, loop1, policy)
6363
loop2.call_later(0.1, get_loop, 1, loop2, policy)
6464
await trio.sleep(0.2)
6565

6666
assert isinstance(asyncio.get_event_loop_policy(), trio_asyncio.TrioPolicy)
6767
assert asyncio._get_running_loop() is None
6868

69+
6970
def test_same_task():
7071
assert not isinstance(asyncio.get_event_loop_policy(), trio_asyncio.TrioPolicy)
7172
trio.run(_test_same_task)
72-

tests/test_sync.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,3 @@ async def bar():
1616
res = loop.run_until_complete(bar())
1717
assert res == "baz"
1818
loop.close()
19-

trio_asyncio/loop.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
# setter stores the policy in a thread-local variable to which our policy
4545
# will forward all requests when Trio is not running.
4646

47+
4748
class _TrioPolicy(asyncio.events.BaseDefaultEventLoopPolicy):
4849
_loop_factory = TrioEventLoop
4950

@@ -122,6 +123,7 @@ def set_event_loop(self, loop):
122123

123124
_orig_policy_get = _aio_event.get_event_loop_policy
124125

126+
125127
def _new_policy_get():
126128
try:
127129
task = trio.hazmat.current_task()
@@ -143,6 +145,7 @@ def _new_policy_get():
143145

144146
_orig_policy_set = _aio_event.set_event_loop_policy
145147

148+
146149
def _new_policy_set(new_policy):
147150
if isinstance(new_policy, TrioPolicy):
148151
raise RuntimeError("You can't set the Trio loop policy manually")
@@ -163,7 +166,6 @@ def _new_policy_set(new_policy):
163166
_aio_event.set_event_loop_policy = _new_policy_set
164167
asyncio.set_event_loop_policy = _new_policy_set
165168

166-
167169
#####
168170

169171
_orig_run_get = _aio_event._get_running_loop
@@ -227,10 +229,12 @@ def set_child_watcher(self, watcher):
227229
watcher.attach_loop(loop)
228230
super().set_child_watcher(watcher)
229231

232+
230233
_original_policy = _orig_policy_get()
231234
_new_policy = TrioPolicy()
232235
_orig_policy_set(_new_policy)
233236

237+
234238
class TrioChildWatcher(asyncio.AbstractChildWatcher if sys.platform != 'win32' else object):
235239
# AbstractChildWatcher not available under Windows
236240
def __init__(self):
@@ -278,6 +282,7 @@ def wrap_generator(proc, *args):
278282
raise RuntimeError("Need to run in a trio_asyncio.open_loop() context")
279283
return loop.wrap_generator(proc, *args)
280284

285+
281286
def run_iterator(aiter):
282287
loop = asyncio.get_event_loop()
283288
if not isinstance(loop, TrioEventLoop):

0 commit comments

Comments
 (0)