Coverage for /pythoncovmergedfiles/medio/medio/usr/local/lib/python3.8/site-packages/nbclient/util.py: 44%
9 statements
« prev ^ index » next coverage.py v7.2.7, created at 2023-07-01 06:54 +0000
« prev ^ index » next coverage.py v7.2.7, created at 2023-07-01 06:54 +0000
1"""General utility methods"""
3# Copyright (c) Jupyter Development Team.
4# Distributed under the terms of the Modified BSD License.
6import inspect
7from typing import Any, Callable, Optional
9from jupyter_core.utils import ensure_async, run_sync # noqa: F401
12async def run_hook(hook: Optional[Callable], **kwargs: Any) -> None:
13 """Run a hook callback."""
14 if hook is None:
15 return
16 res = hook(**kwargs)
17 if inspect.isawaitable(res):
18 await res