class_docstr: Performs the conversion to A-normal form (ANF).
class_docstr_tok: ["Performs","the","conversion","to","A-normal","form","(","ANF",")","."]
docstr: Puts `node` in A-normal form, by replacing it with a variable if needed.
  
  The exact definition of A-normal form is given by the configuration.  The
  parent and the incoming field name are only needed because the configuration
  may be context-dependent.
  
  Args:
    parent: An AST node, the parent of `node`.
    field: The field name under which `node` is the child of `parent`.
    node: An AST node, potentially to be replaced with a variable reference.
  
  Returns:
    node: An AST node; the argument if transformation was not necessary,
      or the new variable reference if it was.
docstr_tok: ["Puts","`","node","`","in","A-normal","form",",","by","replacing","it","with","a","variable","if","needed",".","The","exact","definition","of","A-normal","form","is","given","by","the","configuration",".","The","parent","and","the","incoming","field","name","are","only","needed","because","the","configuration","may","be","context-dependent",".","Args",":","parent",":","An","AST","node",",","the","parent","of","`","node","`",".","field",":","The","field","name","under","which","`","node","`","is","the","child","of","`","parent","`",".","node",":","An","AST","node",",","potentially","to","be","replaced","with","a","variable","reference",".","Returns",":","node",":","An","AST","node",";","the","argument","if","transformation","was","not","necessary",",","or","the","new","variable","reference","if","it","was","."]
code: def _ensure_node_in_anf(self, parent, field, node):
      """Puts `node` in A-normal form, by replacing it with a variable if needed.
  
      The exact definition of A-normal form is given by the configuration.  The
      parent and the incoming field name are only needed because the configuration
      may be context-dependent.
  
      Args:
        parent: An AST node, the parent of `node`.
        field: The field name under which `node` is the child of `parent`.
        node: An AST node, potentially to be replaced with a variable reference.
  
      Returns:
        node: An AST node; the argument if transformation was not necessary,
          or the new variable reference if it was.
      """
      if node is None:
          return node
      if _is_trivial(node):
          return node
      if isinstance(node, list):
          # If something's field was actually a list, e.g., variadic arguments.
          return [
              self._ensure_node_in_anf(parent, field, n) for n in node
          ]
      if isinstance(node, gast.keyword):
          node.value = self._ensure_node_in_anf(
              parent, field, node.value
          )
          return node
      if isinstance(node, (gast.Starred, gast.withitem, gast.slice)):
          # These nodes aren't really extractable in their own right, but their
          # subnodes might be.  Propagate the parent and field name to the child
          # nodes, instead of querying the configuration for children of, e.g.,
          # gast.Starred.
          return self._ensure_fields_in_anf(node, parent, field)
      if self._should_transform(parent, field, node):
          return self._do_transform_node(node)
      else:
          return node
  
imports: import collections
  import gast
  from tensorflow.python.autograph.pyct import gast_util
  from tensorflow.python.autograph.pyct import templates
  from tensorflow.python.autograph.pyct import transformer
label_desc: Use image node_id 7 for calling the AnfTransformer obj's underlying member method code with example usage: obj._ensure_node_in_anf(parent, field, node) and returns: node, node, unknown, node, self, self, node