Skip to content

← programming package

GetItem

Get the item with the specific key or index.

If the item is not found, return the value specified by the 'notfound' port or raise an error. This can also access fields of NeuroPype objects by specifying the field name starting with a leading : (colon), as in: :field_name. The available fields depend on the object being accessed, and can be looked up in the documentation. Typically, the error message will also indicate the available fields. Note that when accessing incorrect fields of an object whose fields are not an open-ended collection (e.g., Packet), an error will be raised even if notfound is not set to '(error)'. This is because this is indicative of a programming error. In contrast, when accessing missing fields of an object with open-ended fields, such as an axis, a node, or a port object, the notfound value is respected. If either the field or the data are None, the output will be None. Version 1.0.0

Ports/Properties

data

Data to process.

  • verbose name: Data
  • default value: None
  • port type: DataPort
  • value type: object (can be None)
  • data direction: IN

item

Extracted item.

  • verbose name: Item
  • default value: None
  • port type: DataPort
  • value type: object (can be None)
  • data direction: OUT

key

Lookup key or index of the element to extract. Depending on the object of which the item is extracted, this can be an integer index (e.g., for a list) or a string key (e.g., for a dictionary). Integer indices count from 0, and can also be negative, in which case they count from the end of the list or array (e.g., -1 is the last element). For NeuroPype objects that have pre-defined fields (e.g., Packets, Chunk, Axis, and so forth), this can also be a field name starting with a leading : (colon), as in: :myfield. However, it is recommended to use the Get Field node for the latter purpose as it more clearly reflects intent.

  • verbose name: Key
  • default value: None
  • port type: Port
  • value type: object (can be None)

notfound

Value to return if key is not found. If set to special value '(error)', raise an error. This can also be set to None or a default value.

  • verbose name: If Not Found
  • default value: (error)
  • port type: Port
  • value type: object (can be None)

set_breakpoint

Set a breakpoint on this node. If this is enabled, your debugger (if one is attached) will trigger a breakpoint.

  • verbose name: Set Breakpoint (Debug Only)
  • default value: False
  • port type: BoolPort
  • value type: bool (can be None)

metadata

User-definable meta-data associated with the node. Usually reserved for technical purposes.

  • verbose name: Metadata
  • default value: {}
  • port type: DictPort
  • value type: dict (can be None)