quart.utils module

exception quart.utils.MustReloadError

Bases: Exception

quart.utils.decode_headers(headers: Iterable[Tuple[bytes, bytes]]) Headers
quart.utils.encode_headers(headers: Headers) List[Tuple[bytes, bytes]]
quart.utils.file_path_to_path(*paths: Union[bytes, str, PathLike]) Path
quart.utils.is_coroutine_function(func: Any) bool
async quart.utils.observe_changes(sleep: Callable[[float], Awaitable[Any]], shutdown_event: Event) None
quart.utils.restart() None
quart.utils.run_sync(func: Callable[[...], Any]) Callable[[...], Coroutine[None, None, Any]]

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.

quart.utils.run_sync_iterable(iterable: Generator[Any, None, None]) AsyncGenerator[Any, None]