Use 4 spaces per indentation level.

    For really old code that you don't want to mess up, you can continue to
    use 8-space tabs.
482485
def indentation(logical_line, previous_logical, indent_char,
                indent_level, previous_indent_level):
    
    if indent_char == ' ' and indent_level % 4:
        return 0, "E111 indentation is not a multiple of four"
    indent_expect = previous_logical.endswith(':')
    if indent_expect and indent_level <= previous_indent_level:
        return 0, "E112 expected an indented block"
    if indent_level > previous_indent_level and not indent_expect:
        return 0, "E113 unexpected indentation"
806750
function indentation(value, maximum) {
  var values = value.split(lineFeed)
  var position = values.length + 1
  var minIndent = Infinity
  var matrix = []
  var index
  var indentation
  var stops
  var padding

  values.unshift(repeat(space, maximum) + exclamationMark)

  while (position--) {
    indentation = getIndent(values[position])

    matrix[position] = indentation.stops

    if (trim(values[position]).length === 0) {
      continue
    }

    if (indentation.indent) {
      if (indentation.indent > 0 && indentation.indent < minIndent) {
        minIndent = indentation.indent
      }
    } else {
      minIndent = Infinity

      break
    }
  }

  if (minIndent !== Infinity) {
    position = values.length

    while (position--) {
      stops = matrix[position]
      index = minIndent

      while (index && !(index in stops)) {
        index--
      }

      if (
        trim(values[position]).length !== 0 &&
        minIndent &&
        index !== minIndent
      ) {
        padding = tab
      } else {
        padding = ''
      }

      values[position] =
        padding + values[position].slice(index in stops ? stops[index] + 1 : 0)
    }
  }

  values.shift()

  return values.join(lineFeed)
}
1012747
public static void indent(int num, PrintWriter out) {
        if (num <= SIXTY_FOUR) {
            out.write(SIXTY_FOUR_SPACES, 0, num);
            return;
        } else if (num <= 128){
            out.write(SIXTY_FOUR_SPACES, 0, SIXTY_FOUR);
            out.write(SIXTY_FOUR_SPACES, 0, num - SIXTY_FOUR);
        } else {
            int times = num / SIXTY_FOUR;
            int rem = num % SIXTY_FOUR;
            for (int i = 0; i< times; i++) {
                out.write(SIXTY_FOUR_SPACES, 0, SIXTY_FOUR);
            }
            out.write(SIXTY_FOUR_SPACES, 0, rem);
            return;
        }
    }
447396
def indent(s, spaces=4):
    
    new = re.sub('(\n+)', '\\1%s' % (' ' * spaces), s)
    return (' ' * spaces) + new.strip()
115675
def _makeIndentFromWidth(self, width):
        
        if self._indenter.useTabs:
            tabCount, spaceCount = divmod(width, self._indenter.width)
            return ('\t' * tabCount) + (' ' * spaceCount)
        else:
            return ' ' * width
1103824
private void resetIndent() {
        setArrayStart("{" + LINE_SEPARATOR + spacer(spaces));
        setArraySeparator("," + LINE_SEPARATOR + spacer(spaces));
        setArrayEnd(LINE_SEPARATOR + spacer(spaces - INDENT) + "}");

        setContentStart("[" + LINE_SEPARATOR + spacer(spaces));
        setFieldSeparator("," + LINE_SEPARATOR + spacer(spaces));
        setContentEnd(LINE_SEPARATOR + spacer(spaces - INDENT) + "]");
    }
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)
832552
def human_indentation(indentation)
      if !indentation.include?(?\t)
        noun = 'space'
      elsif !indentation.include?(?\s)
        noun = 'tab'
      else
        return indentation.inspect
      end

      singular = indentation.length == 1
      "#{indentation.length} #{noun}#{'s' unless singular}"
    end
721350
def indent(self, code, level=1):
    ''''''
    lines = code.split('\n')
    lines = tuple(self.indent_space*level + line for line in lines)
    return '\n'.join(lines)
785304
public static void indent(int num, StringBuilder out) {
        if (num <= SIXTY_FOUR) {
            out.append(SIXTY_FOUR_SPACES, 0, num);
            return;
        } else if (num <= 128){
            // avoid initializing loop counters if only one iteration
            out.append(SIXTY_FOUR_SPACES, 0, SIXTY_FOUR);
            out.append(SIXTY_FOUR_SPACES, 0, num - SIXTY_FOUR);
        } else {
            int times = num / SIXTY_FOUR;
            int rem = num % SIXTY_FOUR;
            for (int i = 0; i< times; i++) {
                out.append(SIXTY_FOUR_SPACES, 0, SIXTY_FOUR);
            }
            out.append(SIXTY_FOUR_SPACES, 0, rem);
            return;
        }
    }
819248
function whitespace(layout) {
	var whitespace = layout.size[0] * layout.size[1]
	for (var i = 0; i < layout.boxes.length; i++) {
		var box = layout.boxes[i]
		whitespace -= box.size[0] * box.size[1]
	}
	return whitespace
}
423058
def indented_script(self) -> bool:
        '''  '''
        # get all leading space, tab and newline
        leading = INDENTED.match(self._script)
        return 0 if leading is None else len(leading.group(2))
190813
public function Indent($code, $spaces)
    {
        $indent = "";
        
        for($i=0; $i<$spaces; $i++)
        {
            $indent .= " ";
        }
        
        if(substr_count($code, "\n") <= 1)
            return $indent . $code;
        
        $code = str_replace("\n", "\n$indent", $code);
        
        return $code;
    }
294394
static function reindent($source, $indent = '', $tabs_to_spaces = 4, $ignore_zero_indent = true) {
		// unify tabs
		if ($tabs_to_spaces !== null) {
			$source = str_replace("\t", str_repeat(' ', $tabs_to_spaces), $source);
		}

		// split into lines
		$lines = explode("\n", $source);

		// detect indent level
		$min_length = null;
		foreach ($lines as $line) {
			if (preg_match('#^([ \t]+)([^ ])#', $line, $matches)) {
				if ($min_length === null) {
					$min_length = strlen($matches[1]);
				}
				else if (strlen($matches[1]) < $min_length) {
					$min_length = strlen($matches[1]);
				}
			}
			else if ( ! $ignore_zero_indent) {
				$min_length = 0;
				break;
			}
		}

		// unify
		foreach ($lines as &$line) {
			if (preg_match('#^[ \t].*#', $line)) {
				$line = $indent.substr($line, $min_length);
			}
			else { # zero line
				$line = $indent.$line;
			}
		}

		return implode("\n", $lines);
	}
477220
public static Indentation tabs(final int level) {
        return level < TABS.length ? TABS[level > 0 ? level : 0] : new Indentation(1, '\t', level);
    }
211782
public static String tabsToSpaces(String in, int tabSize) {
        StringBuilder buf = new StringBuilder();
        int width = 0;
        for (int i = 0; i < in.length(); i++) {
            switch (in.charAt(i)) {
                case '\t':
                    int count = tabSize - (width % tabSize);
                    width += count;
                    while (--count >= 0) {
                        buf.append(' ');
                    }
                    break;
                case '\n':
                    width = 0;
                    buf.append(in.charAt(i));
                    break;
                default:
                    width++;
                    buf.append(in.charAt(i));
                    break;
            }
        }
        return buf.toString();
    }
1120842
protected void rebuildIndentationBuf() {
		if (doIndent == false)
			return;
		final int maxIndent = 65; // hardcoded maximum indentation size in
									// characters
		int bufSize = 0;
		offsetNewLine = 0;
		if (writeLineSepartor) {
			offsetNewLine = lineSeparator.length();
			bufSize += offsetNewLine;
		}
		maxIndentLevel = 0;
		if (writeIndentation) {
			indentationJump = indentationString.length();
			maxIndentLevel = maxIndent / indentationJump;
			bufSize += maxIndentLevel * indentationJump;
		}
		if (indentationBuf == null || indentationBuf.length < bufSize) {
			indentationBuf = new char[bufSize + 8];
		}
		int bufPos = 0;
		if (writeLineSepartor) {
			for (int i = 0; i < lineSeparator.length(); i++) {
				indentationBuf[bufPos++] = lineSeparator.charAt(i);
			}
		}
		if (writeIndentation) {
			for (int i = 0; i < maxIndentLevel; i++) {
				for (int j = 0; j < indentationString.length(); j++) {
					indentationBuf[bufPos++] = indentationString.charAt(j);
				}
			}
		}
	}