nbprint.config.core.Context¶
- pydantic model nbprint.config.core.Context[source]¶
Bases:
BaseModelShow JSON schema
{ "title": "Context", "type": "object", "properties": { "tags": { "items": { "type": "string" }, "title": "Tags", "type": "array" }, "role": { "$ref": "#/$defs/Role", "default": "context" }, "ignore": { "default": true, "title": "Ignore", "type": "boolean" }, "css": { "anyOf": [ { "type": "string" }, { "format": "path", "type": "string" }, { "type": "null" } ], "default": "", "title": "Css" }, "esm": { "anyOf": [ { "type": "string" }, { "format": "path", "type": "string" }, { "type": "null" } ], "default": "", "title": "Esm" }, "classname": { "anyOf": [ { "type": "string" }, { "items": { "type": "string" }, "type": "array" }, { "type": "null" } ], "default": "", "title": "Classname" }, "attrs": { "anyOf": [ { "additionalProperties": { "type": "string" }, "type": "object" }, { "type": "null" } ], "title": "Attrs" }, "parameters": { "anyOf": [ { "$ref": "#/$defs/Parameters" }, { "type": "null" } ], "default": null } }, "$defs": { "Parameters": { "properties": { "tags": { "items": { "type": "string" }, "title": "Tags", "type": "array" }, "role": { "$ref": "#/$defs/Role", "default": "parameters" }, "ignore": { "default": true, "title": "Ignore", "type": "boolean" }, "css": { "anyOf": [ { "type": "string" }, { "format": "path", "type": "string" }, { "type": "null" } ], "default": "", "title": "Css" }, "esm": { "anyOf": [ { "type": "string" }, { "format": "path", "type": "string" }, { "type": "null" } ], "default": "", "title": "Esm" }, "classname": { "anyOf": [ { "type": "string" }, { "items": { "type": "string" }, "type": "array" }, { "type": "null" } ], "default": "", "title": "Classname" }, "attrs": { "anyOf": [ { "additionalProperties": { "type": "string" }, "type": "object" }, { "type": "null" } ], "title": "Attrs" } }, "title": "Parameters", "type": "object" }, "Role": { "enum": [ "undefined", "configuration", "context", "outputs", "parameters", "content", "page", "layout" ], "title": "Role", "type": "string" } }, "additionalProperties": true }
- Fields:
ignore (bool)parameters (nbprint.config.core.parameters.Parameters | None)role (nbprint.config.base.Role)tags (list[str])
- field tags: Annotated[list[str], SerializeAsAny()] [Optional]¶
- field role: Role = Role.CONTEXT¶
- field ignore: bool = True¶
- field parameters: Annotated[Parameters, SerializeAsAny()] | None = None¶
- generate(metadata: dict, config: Configuration, parent: BaseModel, attr: str = '', **kwargs) NotebookNode[source]¶
Generate a notebook node for this model. This will be called before the runtime of the notebook, use it for code generation.
Args:¶
metadata (dict): common cell metadata
Returns:¶
NotebookNode: the content of the notebook node
- model_post_init(context: Any, /) None¶
This function is meant to behave like a BaseModel method to initialise private attributes.
It takes context as an argument since that’s what pydantic-core passes when calling it.
- Parameters:
self – The BaseModel instance.
context – The context.