helper method for formatting source code
 depth is the depth in the tree (os the ast)
 and the string are the ones to be indented (2 spaces)
554685
def at_depth(depth , *strings)
      prefix = " " * 2 * depth
      strings.collect{|str| prefix + str}.join("\n")
    end
803020
function () {
            var indentStr = '';
            for (var i = 0; i < indentLevel; i++) {
                indentStr += INDENT;
            }
            return {
                type: 'WhiteSpace',
                value: indentStr
            };
        }
808159
def format(self, indent_level, indent_size=4):
        

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

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

        name += self.wrap_lines('value: %s\n' % str(self._literal), 1, indent_size)

        return self.wrap_lines(name, indent_level, indent_size)
960850
private static void appendIndentedNewLine(int indentLevel, StringBuilder stringBuilder) {
        stringBuilder.append("\n");
        for (int i = 0; i < indentLevel; i++) {
            // Assuming indention using 2 spaces
            stringBuilder.append("  ");
        }
    }
1193741
def dumped(text, level, indent=2):
    """"""
    return indented("{\n%s\n}" % indented(text, level + 1, indent) or "None", level, indent) + "\n"
637214
def dump(self,indent='',depth=0):
        """"""
        out = []
        out.append( indent+_ustr(self.asList()) )
        keys = self.items()
        keys.sort()
        for k,v in keys:
            if out:
                out.append('\n')
            out.append( "%s%s- %s: " % (indent,('  '*depth), k) )
            if isinstance(v,ParseResults):
                if v.keys():
                    out.append( v.dump(indent,depth+1) )
                else:
                    out.append(_ustr(v))
            else:
                out.append(_ustr(v))
        return "".join(out)
193058
def dump_tree(node, name=None, initial_indent='', indentation='    ',
              maxline=120, maxmerged=80,
              # Runtime optimization
              iter_node=iter_node, special=ast.AST,
              list=list, isinstance=isinstance, type=type, len=len):
    
    def dump(node, name=None, indent=''):
        level = indent + indentation
        name = name and name + '=' or ''
        values = list(iter_node(node))
        if isinstance(node, list):
            prefix, suffix = '%s[' % name, ']'
        elif values:
            prefix, suffix = '%s%s(' % (name, type(node).__name__), ')'
        elif isinstance(node, special):
            prefix, suffix = name + type(node).__name__, ''
        else:
            return '%s%s' % (name, repr(node))
        node = [dump(a, b, level) for a, b in values if b != 'ctx']
        oneline = '%s%s%s' % (prefix, ', '.join(node), suffix)
        if len(oneline) + len(indent) < maxline:
            return '%s' % oneline
        if node and len(prefix) + len(node[0]) < maxmerged:
            prefix = '%s%s,' % (prefix, node.pop(0))
        node = (',\n%s' % level).join(node).lstrip()
        return '%s\n%s%s%s' % (prefix, level, node, suffix)
    return dump(node, name, initial_indent)
728368
def check_width(width, root)
      dummy_node = Struct.new(:line)

      root.children.each do |top_node|
        # once we've found one line with leading space, there's no need to check any more lines
        # `haml` will check indenting_at_start, deeper_indenting, inconsistent_indentation
        break if top_node.children.find do |node|
          line = node.source_code
          leading_space = LEADING_SPACES_REGEX.match(line)

          break unless leading_space && !node.disabled?(self)

          if leading_space[1] != ' ' * width
            record_lint dummy_node.new(node.line), "File does not use #{width}-space indentation"
          end

          break true
        end
      end
    end
1273983
def _add_indent(string, indent):
    
    lines = string.split("\n")
    first, lines = lines[0], lines[1:]
    lines = ["{indent}{s}".format(indent=" " * indent, s=s)
             for s in lines]
    lines = [first] + lines
    return "\n".join(lines)
16430
private void appendLine(final String timeStampStr, final int indentLevel, final String line,
            final StringBuilder buf) {
        buf.append(timeStampStr);
        buf.append('\t');
        buf.append(ClassGraph.class.getSimpleName());
        buf.append('\t');
        final int numDashes = 2 * (indentLevel - 1);
        for (int i = 0; i < numDashes; i++) {
            buf.append('-');
        }
        if (numDashes > 0) {
            buf.append(' ');
        }
        buf.append(line);
        buf.append('\n');
    }
1154884
public void format(StringBuffer fmt, Set done, Set todo, int indent) {
    formatName(fmt, indent);
    fmt.append("*(\n");
    itemType.format(fmt, done, todo, indent + 2);
    fmt.append("\n");
    indent(fmt, indent);
    fmt.append(")*");
  }
1018257
def fix_indentation_depth(query):
    """"""
    lines = query.split('\n')
    final_lines = []

    for line in lines:
        consecutive_spaces = 0
        for char in line:
            if char == ' ':
                consecutive_spaces += 1
            else:
                break

        if consecutive_spaces % 2 != 0:
            raise AssertionError(u'Indentation was not a multiple of two: '
                                 u'{}'.format(consecutive_spaces))

        final_lines.append(('  ' * consecutive_spaces) + line[consecutive_spaces:])

    return '\n'.join(final_lines)
1044452
private void toStringTree(StringBuilder builder, int indent) {
        for (int count = 0; count < indent; count++) {
            builder.append(" ");
        }
        builder.append(this.toString());
        builder.append("\n");
        if (m_children != null) {
            for (UNode childNode : m_children) {
                childNode.toStringTree(builder, indent + 3);
            }
        }
    }
806505
private void newlineAndIndent(){
        if (isWriting()){
            if (isClosed){
                write(Indentation.tabs(depth)); // \n\t\t\t\...
            } else {
                depth++;
                write(Indentation.closedTabs(depth)); // >\n\t\t\t\...
                isClosed = true;
            }
        }
    }
904915
function(sInput, levels, indentString) {
		var indentedLineBreak;

		indentString = indentString || '\t';
		indentedLineBreak = '\n'+ ( new Array( levels + 1 ).join( indentString ) );

		return indentedLineBreak + sInput.split('\n').join(indentedLineBreak);
	}
293069
def format(self, indent_level, indent_size=4):
        

        desc = self.format_name('String')
        return self.wrap_lines(desc, indent_level, indent_size=indent_size)
560084
def _indent(s, indent='  '):
    """"""
    if isinstance(s, six.string_types):
        return '\n'.join(('%s%s' % (indent, line) for line in s.splitlines()))
    return s