map

pydantic model Map[source]

Cardinality expansion

Given a node that emits 1 (iterable) event, split it into separate events.

`{admonition} Implementation Note Map is a *special node* - it is the only node where returning a list of values is interpreted as multiple events. For all other nodes, returning a list of values is interpreted as a single event with a list value. To return multiple events from a single node, chain a `map` after it. `

Show JSON schema
{
   "title": "Map",
   "description": "Cardinality expansion\n\nGiven a node that emits 1 (iterable) event, split it into separate events.\n\n```{admonition} Implementation Note\nMap is a *special node* -\nit is the only node where returning a list of values is interpreted as multiple events.\nFor all other nodes,\nreturning a list of values is interpreted as a single event with a list value.\nTo return multiple events from a single node, chain a `map` after it.\n```",
   "type": "object",
   "properties": {
      "id": {
         "title": "Id",
         "type": "string"
      },
      "spec": {
         "anyOf": [
            {
               "$ref": "#/$defs/NodeSpecification"
            },
            {
               "type": "null"
            }
         ],
         "default": null
      },
      "enabled": {
         "default": true,
         "title": "Enabled",
         "type": "boolean"
      },
      "stateful": {
         "default": true,
         "title": "Stateful",
         "type": "boolean"
      }
   },
   "$defs": {
      "NodeSpecification": {
         "description": "Specification for a single processing node within a tube .yaml file.",
         "properties": {
            "type": {
               "title": "Type",
               "type": "string"
            },
            "id": {
               "title": "Id",
               "type": "string"
            },
            "depends": {
               "anyOf": [
                  {
                     "items": {
                        "anyOf": [
                           {
                              "type": "string"
                           },
                           {
                              "additionalProperties": {
                                 "type": "string"
                              },
                              "maxProperties": 1,
                              "minProperties": 1,
                              "type": "object"
                           }
                        ]
                     },
                     "type": "array"
                  },
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Depends"
            },
            "params": {
               "anyOf": [
                  {
                     "additionalProperties": true,
                     "type": "object"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Params"
            },
            "enabled": {
               "default": true,
               "title": "Enabled",
               "type": "boolean"
            },
            "stateful": {
               "anyOf": [
                  {
                     "type": "boolean"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Stateful"
            },
            "description": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Description"
            }
         },
         "required": [
            "type",
            "id"
         ],
         "title": "NodeSpecification",
         "type": "object"
      }
   },
   "additionalProperties": false,
   "required": [
      "id"
   ]
}

Config:
  • extra: str = forbid

Fields:

model_post_init(_Node__context: Any) None

See docstring of process() for description of post init wrapping of generators

process(value: Sequence[_TInput]) list[_TInput][source]