Module

nodes.functions

Function definition and call nodes for Kida AST.

Classes

DefParam 2
A single parameter in a {% def %} with optional type annotation.

A single parameter in a {% def %} with optional type annotation.

Attributes

Name Type Description
name str
annotation str | None
Def 7
Function definition: {% def name(params) %}...{% end %}

Function definition: {% def name(params) %}...{% end %}

Attributes

Name Type Description
name str
params Sequence[DefParam]
body Sequence[Node]
defaults Sequence[Expr]
vararg str | None
kwarg str | None

Methods

args 0 tuple[str, ...]
Backward-compat bridge: returns parameter names.
property
def args(self) -> tuple[str, ...]
Returns
tuple[str, ...]
Slot 1
Slot placeholder inside {% def %}: {% slot %} or {% slot name %}

Slot placeholder inside {% def %}: {% slot %} or {% slot name %}

Attributes

Name Type Description
name str
SlotBlock 2
Named slot content inside {% call %}: {% slot name %}...{% end %}

Named slot content inside {% call %}: {% slot name %}...{% end %}

Attributes

Name Type Description
name str
body Sequence[Node]
CallBlock 4
Call function with slot content: {% call name(args) %}...{% end %}

Call function with slot content: {% call name(args) %}...{% end %}

Attributes

Name Type Description
call Expr
slots dict[str, Sequence[Node]]
args Sequence[Expr]

Methods

body 0 Sequence[Node]
Backward-compat: default slot content.
property
def body(self) -> Sequence[Node]
Returns
Sequence[Node]