Return a minimal string to print a tree-like structure.

        Kwargs:
            indent (int): The number of indentation levels.
323545
def ast_str(self, indent=0):
        
        line = self.line or 0
        col = self.column or 0
        name = type(self).__name__
        spell = getattr(self, 'name', '[no spelling]')
        result = ' ({})'.format(self.result) if hasattr(self, 'result') else ''
        prefix = indent * '| '
        return '{}[{}:{}] {}{}: {}'.format(prefix, line, col,
                                           name, result, spell)
549057
def get_indent(self, string):
        
        indent_amt = 0

        if string[0] == '\t':
            return '\t'
        for char in string:
            if char == ' ':
                indent_amt += 1
            else:
                return ' ' * indent_amt
1339491
def pretty_str(self, indent=0):
        
        spaces = ' ' * indent
        pretty = spaces + 'class ' + self.name
        if self.superclasses:
            superclasses = ', '.join(self.superclasses)
            pretty += '(' + superclasses + ')'
        pretty += ':\n'
        if self.members:
            pretty += '\n\n'.join(
                    c.pretty_str(indent + 2)
                    for c in self.members
            )
        else:
            pretty += spaces + '  [declaration]'
        return pretty
558602
String getIndentation()
	{
		StringBuilder sb = new StringBuilder();

		for (int i = 0; i < count; i++)
		{
			sb.append(indent);
		}

		return sb.toString();
	}
983101
def to_json(self, indent=2):
        
        return json.dumps(self, default=json_encode_for_printing, indent=indent)
969306
public void printIndent() {
        for (int i = 0; i < indentLevel; i++) {
            try {
                out.write(indent);
            } catch(IOException ioe) {
                throw new GroovyRuntimeException(ioe);
            }
        }
    }
801568
function indent(str, indent) {
            if (typeof indent === 'number') {
                var indent_str = '';
                while (indent_str.length < indent) indent_str += ' ';
                indent = indent_str;
            }
            var lines = str.split(/\n/);
            for (var i=0; i<lines.length; i++) {
                if (lines[i].trim() !== '')
                    lines[i] = indent + lines[i];
            }
            return lines.join("\n");            
        }
1278490
def msg(self, level, s, *args):
        
        if s and level <= self.debug:
            print "%s%s %s" % ("  " * self.indent, s, ' '.join(map(repr, args)))
1070259
def to_sexp(indent=0)
      indented = "  " * indent
      sexp = "#{indented}(#{fancy_type}"

      children.each do |child|
        if child.is_a?(Node)
          sexp += "\n#{child.to_sexp(indent + 1)}"
        else
          sexp += " #{child.inspect}"
        end
      end

      sexp += ")"

      sexp
    end
977874
function printNodes(node, indent) {
  indent = indent || 0;

  print(node.typename + ': ', indent);

  if (node instanceof NodeList) {
    print('\n');
    node.children.forEach((n) => {
      printNodes(n, indent + 2);
    });
  } else if (node instanceof CallExtension) {
    print(`${node.extName}.${node.prop}\n`);

    if (node.args) {
      printNodes(node.args, indent + 2);
    }

    if (node.contentArgs) {
      node.contentArgs.forEach((n) => {
        printNodes(n, indent + 2);
      });
    }
  } else {
    let nodes = [];
    let props = null;

    node.iterFields((val, fieldName) => {
      if (val instanceof Node) {
        nodes.push([fieldName, val]);
      } else {
        props = props || {};
        props[fieldName] = val;
      }
    });

    if (props) {
      print(JSON.stringify(props, null, 2) + '\n', null, true);
    } else {
      print('\n');
    }

    nodes.forEach(([fieldName, n]) => {
      print(`[${fieldName}] =>`, indent + 2);
      printNodes(n, indent + 4);
    });
  }
}
1040591
def find_indentation(node):
    """"""
    while node is not None:
        if node.type == syms.suite and len(node.children) > 2:
            indent = node.children[1]
            if indent.type == token.INDENT:
                return indent.value
        node = node.parent
    return u""
780141
def format(self, indent_level, indent_size=4):
        

        name = self.format_name('Boolean', indent_size)

        if self._require_value is not None:
            if self.long_desc is not None:
                name += '\n'

            name += self.wrap_lines('must be %s\n' % str(self._require_value).lower(), 1, indent_size)

        return self.wrap_lines(name, indent_level, indent_size)
1186252
def dbg_print(self, indent=0):
        
        print("%sA-locs:" % (" " * indent))
        for aloc_id, aloc in self._alocs.items():
            print("%s<0x%x> %s" % (" " * (indent + 2), aloc_id, aloc))

        print("%sMemory:" % (" " * indent))
        self.memory.dbg_print(indent=indent + 2)
492033
def pretty_str(self, indent=0):
        
        return '\n\n'.join(
                codeobj.pretty_str(indent=indent)
                for codeobj in self.children
        )
26099
def _indent(text, level=1):
    '''  '''

    prefix = ' ' * (4 * level)

    def prefixed_lines():
        for line in text.splitlines(True):
            yield (prefix + line if line.strip() else line)

    return ''.join(prefixed_lines())
492639
def tosieve(self, indentlevel=0, target=sys.stdout):
        
        self.__print(self.name, indentlevel, nocr=True, target=target)
        if self.has_arguments():
            for arg in self.args_definition:
                if not arg["name"] in self.arguments:
                    continue
                target.write(" ")
                value = self.arguments[arg["name"]]
                atype = arg["type"]
                if "tag" in atype:
                    target.write(value)
                    if arg["name"] in self.extra_arguments:
                        value = self.extra_arguments[arg["name"]]
                        atype = arg["extra_arg"]["type"]
                        target.write(" ")
                    else:
                        continue

                if type(value) == list:
                    if self.__get_arg_type(arg["name"]) == ["testlist"]:
                        target.write("(")
                        for t in value:
                            t.tosieve(target=target)
                            if value.index(t) != len(value) - 1:
                                target.write(", ")
                        target.write(")")
                    else:
                        target.write(
                            "[{}]".format(", ".join(
                                ['"%s"' % v.strip('"') for v in value])
                            )
                        )
                    continue
                if isinstance(value, Command):
                    value.tosieve(indentlevel, target=target)
                    continue

                if "string" in atype:
                    target.write(value)
                    if not value.startswith('"') and not value.startswith("["):
                        target.write("\n")
                else:
                    target.write(value)

        if not self.accept_children:
            if self.get_type() != "test":
                target.write(";\n")
            return
        if self.get_type() != "control":
            return
        target.write(" {\n")
        for ch in self.children:
            ch.tosieve(indentlevel + 4, target=target)
        self.__print("}", indentlevel, target=target)
164856
function printNodes(node, indent) {
    indent = indent || 0;

    // This is hacky, but this is just a debugging function anyway
    function print(str, indent, inline) {
        var lines = str.split('\n');

        for(var i=0; i<lines.length; i++) {
            if(lines[i]) {
                if((inline && i > 0) || !inline) {
                    for(var j=0; j<indent; j++) {
                        process.stdout.write(' ');
                    }
                }
            }

            if(i === lines.length-1) {
                process.stdout.write(lines[i]);
            }
            else {
                process.stdout.write(lines[i] + '\n');
            }
        }
    }

    print(node.typename + ': ', indent);

    if(node instanceof NodeList) {
        print('\n');
        lib.each(node.children, function(n) {
            printNodes(n, indent + 2);
        });
    }
    else if(node instanceof CallExtension) {
        print(node.extName + '.' + node.prop);
        print('\n');

        if(node.args) {
            printNodes(node.args, indent + 2);
        }

        if(node.contentArgs) {
            lib.each(node.contentArgs, function(n) {
                printNodes(n, indent + 2);
            });
        }
    }
    else {
        var nodes = null;
        var props = null;

        node.iterFields(function(val, field) {
            if(val instanceof Node) {
                nodes = nodes || {};
                nodes[field] = val;
            }
            else {
                props = props || {};
                props[field] = val;
            }
        });

        if(props) {
            print(JSON.stringify(props, null, 2) + '\n', null, true);
        }
        else {
            print('\n');
        }

        if(nodes) {
            for(var k in nodes) {
                printNodes(nodes[k], indent + 2);
            }
        }

    }
}