Coverage for /pythoncovmergedfiles/medio/medio/usr/local/lib/python3.11/site-packages/nbclient/util.py: 50%
Shortcuts on this page
r m x toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
Shortcuts on this page
r m x toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
1"""General utility methods"""
3# Copyright (c) Jupyter Development Team.
4# Distributed under the terms of the Modified BSD License.
5from __future__ import annotations
7import inspect
8from typing import Any, Callable
10from jupyter_core.utils import ensure_async, run_sync
12__all__ = ["ensure_async", "run_sync", "run_hook"]
15async def run_hook(hook: Callable[..., Any] | None, **kwargs: Any) -> None:
16 """Run a hook callback."""
17 if hook is None:
18 return
19 res = hook(**kwargs)
20 if inspect.isawaitable(res):
21 await res