Skip to content

Commit b2abd77

Browse files
committed
Linter
1 parent 7aa27b5 commit b2abd77

4 files changed

Lines changed: 23 additions & 19 deletions

File tree

extraasync/__init__.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,12 @@
66
__version__ = "0.3.0"
77

88

9-
__all__ = ["aenumerate", "ExtraTaskGroup", "sync_to_async", "async_to_sync", "at_loop_stop_callback", "remove_loop_stop_callback", "__version__"]
9+
__all__ = [
10+
"aenumerate",
11+
"ExtraTaskGroup",
12+
"sync_to_async",
13+
"async_to_sync",
14+
"at_loop_stop_callback",
15+
"remove_loop_stop_callback",
16+
"__version__",
17+
]

extraasync/aenumerate.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,3 @@ async def __aiter__(self):
1919

2020
def __repr__(self):
2121
return f"Asynchronous enumeration for {self.iterable!r} at index {self.index!r}"
22-

extraasync/async_hooks.py

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@
77
from asyncio import events
88
from asyncio.events import AbstractEventLoop
99

10-
11-
1210
DEBUG = False
1311

1412

@@ -26,6 +24,7 @@ class Py313BaseEventLoop:
2624
into Python's asyncio BaseEventLoop
2725
2826
"""
27+
2928
# Lib/asyncio/base_events.py
3029
def _run_forever_setup(self):
3130
"""Prepare the run loop to process events.
@@ -42,7 +41,7 @@ def _run_forever_setup(self):
4241
self._thread_id = threading.get_ident()
4342
sys.set_asyncgen_hooks(
4443
firstiter=self._asyncgen_firstiter_hook,
45-
finalizer=self._asyncgen_finalizer_hook
44+
finalizer=self._asyncgen_finalizer_hook,
4645
)
4746

4847
events._set_running_loop(self)
@@ -82,17 +81,21 @@ def run_forever(self):
8281
ok_to_patch = False
8382

8483
if not ok_to_patch:
85-
raise RuntimeError("Python 3.12 requires patching asyncio before the async loop starts."
84+
raise RuntimeError(
85+
"Python 3.12 requires patching asyncio before the async loop starts."
8686
" Please import extraasync before setting up your async loop"
8787
)
88-
asyncio.base_events.BaseEventLoop._run_forever_setup = Py313BaseEventLoop._run_forever_setup
89-
asyncio.base_events.BaseEventLoop._run_forever_cleanup = Py313BaseEventLoop._run_forever_cleanup
88+
asyncio.base_events.BaseEventLoop._run_forever_setup = (
89+
Py313BaseEventLoop._run_forever_setup
90+
)
91+
asyncio.base_events.BaseEventLoop._run_forever_cleanup = (
92+
Py313BaseEventLoop._run_forever_cleanup
93+
)
9094
asyncio.base_events.BaseEventLoop.run_forever = Py313BaseEventLoop.run_forever
9195

9296
# Now, it is "B.A.U."
9397

9498

95-
9699
if not hasattr(asyncio.BaseEventLoop, "_run_forever_cleanup"):
97100

98101
warnings.warn(
@@ -150,16 +153,14 @@ def new_run_forever_cleanup():
150153
cb()
151154
except Exception as exc:
152155
if not DEBUG:
153-
warnings.warn(
154-
f"""\
156+
warnings.warn(f"""\
155157
Supressed Exception raised on loop callback {cb.__name__}:
156158
{exc}
157159
158160
set extraasync.async_hooks.DEBUG to True
159161
to have it raised instead.
160162
161-
"""
162-
)
163+
""")
163164
else:
164165
raise exc
165166
original_clean_up()

extraasync/sync_async_bridge.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -152,15 +152,11 @@ def _sync_to_async_non_bridge(
152152
try:
153153
loop = asyncio.new_event_loop()
154154
except RuntimeError:
155-
raise RuntimeError(
156-
D(
157-
"""\
155+
raise RuntimeError(D("""\
158156
Error trying to create a new async loop - to be able to call 'sync_to_async' from
159157
code inside a running async loop, the parent 'sync execution branch' must be called
160158
with `extraasync.async_to_sync`.
161-
"""
162-
)
163-
)
159+
"""))
164160
_non_bridge_loop.set(loop)
165161

166162
return loop.run_until_complete(coro)

0 commit comments

Comments
 (0)