Skip to content

Commit

Permalink
MAINT: Coro is not coro-function. (#330)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Carreau authored Jan 5, 2023
1 parent a8451ef commit 589bf43
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
1 change: 1 addition & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,4 @@ repos:
hooks:
- id: ruff
args: ["--fix"]
exclude: script
8 changes: 5 additions & 3 deletions jupyter_core/utils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,15 +137,17 @@ def run_sync(coro: Callable[..., Awaitable[T]]) -> Callable[..., T]:
Parameters
----------
coro : coroutine
The coroutine to be executed.
coro : coroutine-function
The coroutine-function to be executed.
Returns
-------
result :
Whatever the coroutine returns.
Whatever the coroutine-function returns.
"""

assert inspect.iscoroutinefunction(coro)

def wrapped(*args, **kwargs):
name = threading.current_thread().name
inner = coro(*args, **kwargs)
Expand Down

0 comments on commit 589bf43

Please sign in to comment.