Change the indentation of `code` to `new_indents`
189050
def fix_indentation(code, new_indents):
    """"""
    min_indents = find_minimum_indents(code)
    return indent_lines(code, new_indents - min_indents)
362189
def globalize_indentation(src):
    
    lines = src.splitlines()
    indent = len(lines[0]) - len(lines[0].strip(' '))
    func_src = ''
    for ii, l in enumerate(src.splitlines()):
        line = l[indent:]
        func_src += line + '\n'
    return func_src
340917
def get_indentation(func):
    
    src_lines = getsourcelines(func)[0]
    for line in src_lines:
        if not (line.startswith('@') or line.startswith('def') or line.lstrip().startswith('#')):
            return line[:len(line) - len(line.lstrip())]
    return pytypes.default_indent
649771
function nodeToRangeLines(node, code, engine) {
  var range = engine.nodeToRange(node);

  // we want to keep starting indentation, so search back to the previous
  // newline
  var start = range.start;
  while (start > 0 && code[start] !== "\n") {
    start--;
  }
  if (code[start] === "\n") {
    start++; // don't include the newline
  }

  // we also want to read to the end of the line for the node we found
  var end = range.end;
  while (end < code.length && code[end] !== "\n") {
    end++;
  }

  return { start: start, end: end };
}
1157465
def _clean_code(self, code):
        
        lines = code.split("\n")
        min_indent = 100
        for line in lines:
            if line.strip() != "":
                indent = len(line) - len(line.lstrip())
                min_indent = min(indent, min_indent)
        if min_indent > 0:
            lines = [line[min_indent:] for line in lines]
        code = "\n".join(lines)
        return code
380221
def _indent(stream, indent, *msgs):

    

    for x in range(0, indent):
        stream.write("  ")
    for x in msgs:
        # Any nicer way? In Py2 x can be 'str' or 'unicode'.
        stream.write(x.encode("ascii", "backslashreplace").decode("ascii"))
    stream.write("\n")
1206395
def _format_code(source, preferred_quote):
    """"""
    if not source:
        return source

    modified_tokens = []

    sio = io.StringIO(source)
    for (token_type,
         token_string,
         start,
         end,
         line) in tokenize.generate_tokens(sio.readline):

        if token_type == tokenize.STRING:
            token_string = unify_quotes(token_string,
                                        preferred_quote=preferred_quote)

        modified_tokens.append(
            (token_type, token_string, start, end, line))

    return untokenize.untokenize(modified_tokens)
163975
function indent(str, prefix) {
  prefix = prefix || '   ';
  var lines = str.split("\n");
  lines.forEach(function(line, i) {
    lines[i] = prefix + line;
  });
  return lines.join("\n");
}
1020426
def indent(block, spaces):
    
    new_block = ''
    for line in block.split('\n'):
        new_block += spaces + line + '\n'
    return new_block
1193741
def dumped(text, level, indent=2):
    """"""
    return indented("{\n%s\n}" % indented(text, level + 1, indent) or "None", level, indent) + "\n"
483417
def replace_tab_indent(s, replace="    "):
    
    prefix = get_indent_prefix(s)
    return prefix.replace("\t", replace) + s[len(prefix):]
295110
def _indent(text, amount):
    
    indentation = amount * ' '
    return indentation + ('\n' + indentation).join(text.split('\n'))
1093808
def add_indent_lines(prefix, s):
    
    if not s:
        return prefix
    prefix_len = str_visible_len(prefix)
    lines = s.splitlines(True)
    return "".join([prefix + lines[0]] + [" " * prefix_len + l for l in lines[1:]])
1179734
def indent(buffer, from_row, to_row, count=1):
    
    current_row = buffer.document.cursor_position_row
    line_range = range(from_row, to_row)

    # Apply transformation.
    new_text = buffer.transform_lines(line_range, lambda l: '    ' * count + l)
    buffer.document = Document(
        new_text,
        Document(new_text).translate_row_col_to_index(current_row, 0))

    # Go to the start of the line.
    buffer.cursor_position += buffer.document.get_start_of_line_position(after_whitespace=True)
742147
function undent(code) {
  let lines = code.split("\n");
  let minIndent = Number.MAX_VALUE;

  // find min indent
  lines.forEach(line => {
    let startingSpaceMatch = line.match(/^\s*/);
    let indentLength = startingSpaceMatch[0].length;
    if (indentLength < minIndent) {
      minIndent = indentLength;
    }
  });

  // remove the indentation from each line
  return lines
    .map(line => {
      return line.substring(minIndent);
    })
    .join("\n");
}
1116377
def indent(self):
        
        cursor = self.editor.textCursor()
        assert isinstance(cursor, QtGui.QTextCursor)
        if cursor.hasSelection():
            self.indent_selection(cursor)
        else:
            # simply insert indentation at the cursor position
            tab_len = self.editor.tab_length
            if cursor.positionInBlock() < self.min_column and not cursor.atBlockEnd():
                cursor.movePosition(cursor.Right, cursor.MoveAnchor, self.min_column)
            cursor.beginEditBlock()
            if self.editor.use_spaces_instead_of_tabs:
                nb_space_to_add = tab_len - (cursor.positionInBlock() - self.min_column) % tab_len
                cursor.insertText(nb_space_to_add * " ")
            else:
                cursor.insertText('\t')
            cursor.endEditBlock()
            self.editor.setTextCursor(cursor)
787115
def _indent_change(change, out, options, indent):
    

    show_unchanged = getattr(options, "show_unchanged", False)
    show_ignored = getattr(options, "show_ignored", False)

    show = False
    desc = change.get_description()

    if change.is_change():
        if change.is_ignored(options):
            if show_ignored:
                show = True
                _indent(out, indent, desc, " [IGNORED]")
        else:
            show = True
            _indent(out, indent, desc)
    elif show_unchanged:
        show = True
        _indent(out, indent, desc)

    if show:
        indent += 1
        for sub in change.collect():
            _indent_change(sub, out, options, indent)