Share via


FunctionIdBlock Class

Block to represent a function id. It can be used to call a function from a plugin.

The content is parsed using a regex, that returns either a plugin and function name or just a function name, depending on the content.

Anything other than that and a ValueError is raised.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Constructor

FunctionIdBlock(*, content: str, function_name: str = '', plugin_name: str | None = None)

Parameters

Name Description
content
Required
str

The content of the block.

function_name
Required
<xref:Optional>[str],<xref: optional>

The function name.

plugin_name
Required
<xref:Optional>[str],<xref: optional>

The plugin name.

Keyword-Only Parameters

Name Description
content
Required
function_name
Required
plugin_name
Required

Methods

parse_content

Parse the content of the function id block and extract the plugin and function name.

If both are present in the fields, return the fields as is. Otherwise, use the regex to extract the plugin and function name.

render

Render the function id block.

parse_content

Parse the content of the function id block and extract the plugin and function name.

If both are present in the fields, return the fields as is. Otherwise, use the regex to extract the plugin and function name.

parse_content(fields: Any) -> dict[str, Any]

Parameters

Name Description
fields
Required

render

Render the function id block.

render(*_: Kernel | KernelArguments | None) -> str

Attributes

function_name

function_name: str

plugin_name

plugin_name: str | None

type

type: ClassVar[BlockTypes] = 6