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: Gets all dsl_context.DslContexts that the node belongs to.
  
  Args:
    node: A BaseNode that has been put to the registry.
  Raises:
    ValueError: If the node is unknown to the registry.
  Returns:
    List of DslContexts that wraps the node, ordered by outer-most to
    inner-most, possibly empty list.
docstr_tok: ["Gets","all","dsl_context.DslContexts","that","the","node","belongs","to",".","Args",":","node",":","A","BaseNode","that","has","been","put","to","the","registry",".","Raises",":","ValueError",":","If","the","node","is","unknown","to","the","registry",".","Returns",":","List","of","DslContexts","that","wraps","the","node",",","ordered","by","outer-most","to","inner-most",",","possibly","empty","list","."]
code: def get_contexts(
      self, node: _BaseNode
  ) -> List[dsl_context.DslContext]:
      """Gets all dsl_context.DslContexts that the node belongs to.
  
      Args:
        node: A BaseNode that has been put to the registry.
      Raises:
        ValueError: If the node is unknown to the registry.
      Returns:
        List of DslContexts that wraps the node, ordered by outer-most to
        inner-most, possibly empty list.
      """
      # This is O(N^2), but not performance critical.
      if node not in self._all_nodes:
          raise ValueError(
              f"Node {_format_node(node)} does not exist in the registry. "
              f'Valid: {", ".join([_format_node(n) for n in self._all_nodes])})'
          )
      result = []
      for context in self._all_contexts:
          if node in self._nodes_by_context[context]:
              result.append(context)
      return result
  
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 15 for calling the DslContextRegistry obj's underlying member method code with example usage: obj.get_contexts(node) and returns: result