shipany.bot.conversation.renders
shipany.bot.conversation.renders package
Submodules
shipany.bot.conversation.renders.attributes_mapping module
class shipany.bot.conversation.renders.attributes_mapping.VariablesGetter
Bases: Mapping[str, Any]
The variables getter to provide the attributes from the context.
- Parameters:
- ctx (
ConversationContext) — The conversation context. - captures_scopes (
list[Scope]) — The scopes to get the captures from. - safe (
bool) — The flag to hide the secrets.
- ctx (
__init__(ctx, captures_scopes, *, safe)
- Parameters:
- self (Self)
- ctx (ConversationContext)
- captures_scopes (list [Scope ])
- safe (bool)
- Return type: None
shipany.bot.conversation.renders.jinja_env module
shipany.bot.conversation.renders.jinja_env.template_from_context(template, ctx, *, scopes, safe)
Render the template with the context.
- Parameters:
- template (str) — The template to render.
- ctx (ConversationContext) — The conversation context.
- scopes (list [Scope ]) — The scopes to use.
- safe (bool) — Whether to render safely.
- Returns: The rendered template.
- Return type: str
shipany.bot.conversation.renders.jinja_env.value_from_context(attribute, ctx, *, scopes, safe)
Get the value from the context.
- Parameters:
- attribute (str) — The attribute to get.
- ctx (ConversationContext) — The conversation context.
- scopes (list [Scope ]) — The scopes to use.
- safe (bool) — Whether to render safely.
- Returns: The value from the context.
- Return type: str