Skip to main content
`Ctrl`+`K`

# jupyter_core.utils package

## Module contents

jupyter_core.utils.deprecation(message, internal='jupyter_core/')

  Generate a deprecation warning targeting the first frame that is not ‘internal’

  internal is a string or list of strings, which if they appear in filenames in the frames, the frames will be considered internal. Changing this can be useful if, for example, we know that our internal code is calling out to another library.

  Return type:

    `None`

async jupyter_core.utils.ensure_async(obj)

  Convert a non-awaitable object to a coroutine if needed, and await it if it was not already awaited.

  This function is meant to be called on the result of calling a function, when that function could either be asynchronous or not.

  Return type:

    `TypeVar`(`T`)

jupyter_core.utils.ensure_dir_exists(path, mode=511)

  Ensure that a directory exists

  If it doesn’t exist, try to create it, protecting against a race condition if another process is doing the same. The default permissions are determined by the current umask.

  Return type:

    `None`

jupyter_core.utils.ensure_event_loop(prefer_selector_loop=False)
  Return type:

    `AbstractEventLoop`

jupyter_core.utils.run_sync(coro)

  Wraps coroutine in a function that blocks until it has executed.

  Return type:

    `Callable`[`...`, `TypeVar`(`T`)]

  ### Parameters

  corocoroutine-function

    The coroutine-function to be executed.

  ### Returns

  result :

    Whatever the coroutine-function returns.