node_update

roman_datamodels.datamodels.node_update(to_node: DNode | LNode | TaggedScalarNode, from_node: DNode | LNode | TaggedScalarNode | DataModel, extras: list[str] | tuple[str, ...] | None = None, extras_key: str | None = None, ignore: list[str] | tuple[str, ...] | None = None) None[source]

Copy node contents from an existing node to another existing node

How the copy occurs depends on existence of keys in to_node

If key exists in to_node, contents are converted from from_node stnode type to the stnode type expected in order to preserve validation of the node.

If key only exists in from_node, the contents are copied as-is.

If key exists in the list extras, the contents are placed in the dict ["extras"]. if extras_key is given, then the sub-dictionary ["extras"][extras_key] is used. Extra keys are used to avoid collisions between node trees where the underlying structures are completely different.

Keys in ignore are not considered.

Keys are also

Parameters:
  • to_node (DNode, LNode or TaggedScalarNode) – Node to receive the contents.

  • from_node (DNode, LNode, TaggedScalarNode or DataModel) – Node to copy from

  • extras (list[str], tuple[str, ...] or None) – Keys that may create collisions between the two node trees. All such keys are placed in the extras key. If extras_key is defined, the contents are placed in a subdict of that name.

  • extras_key (str or None) – See parameter extras.

  • ignore (list[str], tuple[str, ...] or None) – Keys that should be completely ignored.