quart.utils module#

exception quart.utils.MustReloadError#

Bases: Exception

quart.utils.file_path_to_path(*paths)#
Parameters:

paths (bytes | str | PathLike)

Return type:

Path

quart.utils.run_sync(func)#

Ensure that the sync function is run within the event loop.

If the func is not a coroutine it will be wrapped such that it runs in the default executor (use loop.set_default_executor to change). This ensures that synchronous functions do not block the event loop.

Parameters:

func (Callable[[...], Any])

Return type:

Callable[[…], Coroutine[None, None, Any]]

quart.utils.run_sync_iterable(iterable)#
Parameters:

iterable (Iterator[T])

Return type:

AsyncIterator[T]

quart.utils.encode_headers(headers)#
Parameters:

headers (Headers)

Return type:

list[tuple[bytes, bytes]]

quart.utils.decode_headers(headers)#
Parameters:

headers (Iterable[tuple[bytes, bytes]])

Return type:

Headers

async quart.utils.observe_changes(sleep, shutdown_event)#
Parameters:
  • sleep (Callable[[float], Awaitable[Any]])

  • shutdown_event (Event)

Return type:

None

quart.utils.restart()#
Return type:

None

async quart.utils.cancel_tasks(tasks)#
Parameters:

tasks (set[Task])

Return type:

None

quart.utils.raise_task_exceptions(tasks)#
Parameters:

tasks (set[Task])

Return type:

None