class_docstr: Registry for DslContexts and associated BaseNodes of a pipeline DSL.
  
  DslContextRegistry manages the active DslContexts, their orders, BaseNodes,
  and association between DslContext and BaseNodes during the pipeline DSL
  definition. DslContext and BaseNode always belong to exactly one
  DslContextRegistry (1:n relationship).
class_docstr_tok: ["Registry","for","DslContexts","and","associated","BaseNodes","of","a","pipeline","DSL",".","DslContextRegistry","manages","the","active","DslContexts",",","their","orders",",","BaseNodes",",","and","association","between","DslContext","and","BaseNodes","during","the","pipeline","DSL","definition",".","DslContext","and","BaseNode","always","belong","to","exactly","one","DslContextRegistry","(","1",":","n","relationship",")","."]
docstr: Replaces one node instance to another in a registry.
docstr_tok: ["Replaces","one","node","instance","to","another","in","a","registry","."]
code: def replace_node(
      self, node_from: _BaseNode, node_to: _BaseNode
  ) -> None:
      """Replaces one node instance to another in a registry."""
      self._check_mutable()
      if node_from not in self._all_nodes:
          raise ValueError(
              f"{node_from} does not exist in pipeline registry."
          )
      self._all_nodes[self._all_nodes.index(node_from)] = node_to
      for context in self._all_contexts:
          nodes = self._nodes_by_context[context]
          if node_from in nodes:
              nodes[nodes.index(node_from)] = node_to
              context.replace_node(node_from, node_to)
              context.validate(nodes)
  
imports: import collections
  import contextlib
  import threading
  from typing import Any, List, Optional, Iterator
  from tfx.dsl.context_managers import dsl_context
label_desc: Use image node_id 13 for calling the DslContextRegistry obj's underlying member method code with example usage: obj.replace_node(node_from, node_to) without return types