Skip to content

Commit 589bf43

Browse files
authored
MAINT: Coro is not coro-function. (#330)
in the following ```python async def hello(): return 1 ``` `hello` is a coroutine function, and `hello()` a coroutine. Fix the vocabulary and ensure that the function is properly used.
1 parent a8451ef commit 589bf43

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

.pre-commit-config.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,3 +39,4 @@ repos:
3939
hooks:
4040
- id: ruff
4141
args: ["--fix"]
42+
exclude: script

jupyter_core/utils/__init__.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -137,15 +137,17 @@ def run_sync(coro: Callable[..., Awaitable[T]]) -> Callable[..., T]:
137137
138138
Parameters
139139
----------
140-
coro : coroutine
141-
The coroutine to be executed.
140+
coro : coroutine-function
141+
The coroutine-function to be executed.
142142
143143
Returns
144144
-------
145145
result :
146-
Whatever the coroutine returns.
146+
Whatever the coroutine-function returns.
147147
"""
148148

149+
assert inspect.iscoroutinefunction(coro)
150+
149151
def wrapped(*args, **kwargs):
150152
name = threading.current_thread().name
151153
inner = coro(*args, **kwargs)

0 commit comments

Comments
 (0)