Share via


code_block Module

Classes

CodeBlock

Create a code block.

A code block is a block that usually contains functions to be executed by the kernel. It consists of a list of tokens that can be either a function_id, value, a variable or a named argument.

If the first token is not a function_id but a variable or value, the rest of the tokens will be ignored. Only the first argument for the function can be a variable or value, the rest of the tokens have be named arguments.

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.