class_docstr: The base class for nodes and leaves.
class_docstr_tok: ["The","base","class","for","nodes","and","leaves","."]
docstr: Returns a formatted dump of the parser tree rooted at this node or leaf. This is
  mainly useful for debugging purposes.
  
  The ``indent`` parameter is interpreted in a similar way as :py:func:`ast.dump`.
  If ``indent`` is a non-negative integer or string, then the tree will be
  pretty-printed with that indent level. An indent level of 0, negative, or ``""``
  will only insert newlines. ``None`` selects the single line representation.
  Using a positive integer indent indents that many spaces per level. If
  ``indent`` is a string (such as ``"\t"``), that string is used to indent each
  level.
  
  :param indent: Indentation style as described above. The default indentation is
      4 spaces, which yields a pretty-printed dump.
  
  >>> import parso
  >>> print(parso.parse("lambda x, y: x + y").dump())
  Module([
      Lambda([
          Keyword('lambda', (1, 0)),
          Param([
              Name('x', (1, 7), prefix=' '),
              Operator(',', (1, 8)),
          ]),
          Param([
              Name('y', (1, 10), prefix=' '),
          ]),
          Operator(':', (1, 11)),
          PythonNode('arith_expr', [
              Name('x', (1, 13), prefix=' '),
              Operator('+', (1, 15), prefix=' '),
              Name('y', (1, 17), prefix=' '),
          ]),
      ]),
      EndMarker('', (1, 18)),
  ])
code: def dump(self, *, indent: Optional[Union[int, str]] = 4) -> str:
      """
      Returns a formatted dump of the parser tree rooted at this node or leaf. This is
      mainly useful for debugging purposes.
  
      The ``indent`` parameter is interpreted in a similar way as :py:func:`ast.dump`.
      If ``indent`` is a non-negative integer or string, then the tree will be
      pretty-printed with that indent level. An indent level of 0, negative, or ``""``
      will only insert newlines. ``None`` selects the single line representation.
      Using a positive integer indent indents that many spaces per level. If
      ``indent`` is a string (such as ``"\\t"``), that string is used to indent each
      level.
  
      :param indent: Indentation style as described above. The default indentation is
          4 spaces, which yields a pretty-printed dump.
  
      >>> import parso
      >>> print(parso.parse("lambda x, y: x + y").dump())
      Module([
          Lambda([
              Keyword('lambda', (1, 0)),
              Param([
                  Name('x', (1, 7), prefix=' '),
                  Operator(',', (1, 8)),
              ]),
              Param([
                  Name('y', (1, 10), prefix=' '),
              ]),
              Operator(':', (1, 11)),
              PythonNode('arith_expr', [
                  Name('x', (1, 13), prefix=' '),
                  Operator('+', (1, 15), prefix=' '),
                  Name('y', (1, 17), prefix=' '),
              ]),
          ]),
          EndMarker('', (1, 18)),
      ])
      """
      if indent is None:
          newline = False
          indent_string = ""
      elif isinstance(indent, int):
          newline = True
          indent_string = " " * indent
      elif isinstance(indent, str):
          newline = True
          indent_string = indent
      else:
          raise TypeError(
              f"expect 'indent' to be int, str or None, got {indent!r}"
          )
  
      def _format_dump(
          node: NodeOrLeaf, indent: str = "", top_level: bool = True
      ) -> str:
          result = ""
          node_type = type(node).__name__
          if isinstance(node, Leaf):
              result += f"{indent}{node_type}("
              if isinstance(node, ErrorLeaf):
                  result += f"{node.token_type!r}, "
              elif isinstance(node, TypedLeaf):
                  result += f"{node.type!r}, "
              result += f"{node.value!r}, {node.start_pos!r}"
              if node.prefix:
                  result += f", prefix={node.prefix!r}"
              result += ")"
          elif isinstance(node, BaseNode):
              result += f"{indent}{node_type}("
              if isinstance(node, Node):
                  result += f"{node.type!r}, "
              result += "["
              if newline:
                  result += "\n"
              for child in node.children:
                  result += _format_dump(
                      child,
                      indent=indent + indent_string,
                      top_level=False,
                  )
              result += f"{indent}])"
          else:  # pragma: no cover
              # We shouldn't ever reach here, unless:
              # - `NodeOrLeaf` is incorrectly subclassed else where
              # - or a node's children list contains invalid nodes or leafs
              # Both are unexpected internal errors.
              raise TypeError(f"unsupported node encountered: {node!r}")
          if not top_level:
              if newline:
                  result += ",\n"
              else:
                  result += ", "
          return result
  
      return _format_dump(self)
  
imports: from abc import abstractmethod, abstractproperty
  from typing import List, Optional, Tuple, Union
  from parso.utils import split_lines
label_desc: Use image node_id 13 for calling the NodeOrLeaf obj's underlying member method code with example usage: obj.dump() and returns: _format_dump, result