Utils

TagScriptEngine.utils.escape_content(string: str) str[source]

Escapes given input to avoid tampering with engine/block behavior.

Returns:

The escaped content.

Return type:

str

async TagScriptEngine.utils.maybe_await(func: Callable[[...], Any] | Awaitable[Any], *args, **kwargs) Any[source]

Await the given function if it is awaitable or call it synchronously.

Returns:

The result of the awaitable function.

Return type:

Any