Extracts a function's indentation as a string,
    In contrast to an inspect.indentsize based implementation,
    this function preserves tabs if present.
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
909087
private static char[] getIndent(int indentSize, Map<Integer, char[]> indentCache) {
        char[] indent = indentCache.get(indentSize);
        if (indent == null) {
            indent = new char[indentSize];
            Arrays.fill(indent, SPACE);
            indentCache.put(indentSize, indent);
        }

        return indent;
    }
1042820
def indent(indent_str=None):
    

    def indentation_rule():
        inst = Indentator(indent_str)
        return {'layout_handlers': {
            OpenBlock: layout_handler_openbrace,
            CloseBlock: layout_handler_closebrace,
            EndStatement: layout_handler_semicolon,
            Space: layout_handler_space_imply,
            OptionalSpace: layout_handler_space_optional_pretty,
            RequiredSpace: layout_handler_space_imply,
            Indent: inst.layout_handler_indent,
            Dedent: inst.layout_handler_dedent,
            Newline: inst.layout_handler_newline,
            OptionalNewline: inst.layout_handler_newline_optional,
            (Space, OpenBlock): NotImplemented,
            (Space, EndStatement): layout_handler_semicolon,
            (OptionalSpace, EndStatement): layout_handler_semicolon,
            (Indent, Newline, Dedent): rule_handler_noop,
        }}
    return indentation_rule
443271
function html(obj, indents) {
  indents = indents || 1;

  function indent() {
    return Array(indents).join('  ');
  }

  if ('string' == typeof obj) {
    var str = escape(obj);
    if (urlRegex().test(obj)) {
      str = '<a href="' + str + '">' + str + '</a>';
    }
    return span('string value', '"' + str + '"');
  }

  if ('number' == typeof obj) {
    return span('number', obj);
  }

  if ('boolean' == typeof obj) {
    return span('boolean', obj);
  }

  if (null === obj) {
    return span('null', 'null');
  }

  var buf;

  if (Array.isArray(obj)) {
    ++indents;

    buf = '[\n' + obj.map(function(val){
      return indent() + html(val, indents);
    }).join(',\n');

    --indents;
    buf += '\n' + indent() + ']';
    return buf;
  }

  buf = '{';
  var keys = Object.keys(obj);
  var len = keys.length;
  if (len) buf += '\n';

  ++indents;
  buf += keys.map(function(key){
    var val = obj[key];
    key = '"' + key + '"';
    key = span('string key', key);
    return indent() + key + ': ' + html(val, indents);
  }).join(',\n');
  --indents;

  if (len) buf += '\n' + indent();
  buf += '}';

  return buf;
}
492033
def pretty_str(self, indent=0):
        
        return '\n\n'.join(
                codeobj.pretty_str(indent=indent)
                for codeobj in self.children
        )
24516
function(str, indent) {
			var lines = str.split("\n");
			for (var i=0; i<lines.length; i++)
				lines[i] = indent + lines[i];
			return lines.join("\n");
		}
900124
def convert_indentation_to_tabs(self):
        

        cursor = self.textCursor()

        block = self.document().findBlockByLineNumber(0)
        while block.isValid():
            cursor.setPosition(block.position())
            search = re.match(r"^ +", block.text())
            if search:
                cursor.movePosition(QTextCursor.StartOfBlock, QTextCursor.MoveAnchor)
                searchLength = len(search.group(0))
                foundations.common.repeat(
                    lambda: cursor.movePosition(QTextCursor.Right, QTextCursor.KeepAnchor), searchLength)
                cursor.insertText(self.__indent_marker * (searchLength / self.__indent_width))
            block = block.next()
        return True
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)
50272
def indent_string(string, num_spaces=2):
    '''

    '''
    indent = ' '.ljust(num_spaces)
    return indent + re.sub('\n', '\n' + indent, string)
438179
def pretty_str(self, indent=0):
        
        if self.parenthesis:
            return (' ' * indent) + '(' + self.name + ')'
        return (' ' * indent) + self.name
192799
def indent_func(input_):
    
    if isinstance(input_, six.string_types):
        # A label was specified
        lbl = input_
        return _indent_decor(lbl)
    elif isinstance(input_, (bool, tuple)):
        # Allow individually turning of of this decorator
        func = input_
        return func
    else:
        # Use the function name as the label
        func = input_
        lbl = '[' + meta_util_six.get_funcname(func) + ']'
        return _indent_decor(lbl)(func)
671944
def str_blockIndent(astr_buf, a_tabs=1, a_tabLength=4, **kwargs):
    
    str_tabBoundary = " "
    for key, value in kwargs.iteritems():
      if key == 'tabBoundary':  str_tabBoundary = value
    b_trailN = False
    length = len(astr_buf)
    ch_trailN = astr_buf[length - 1]
    if ch_trailN == '\n':
      b_trailN = True
      astr_buf = astr_buf[0:length - 1]
    str_ret = astr_buf
    str_tab = ''
    str_Indent = ''
    for i in range(a_tabLength):
        str_tab = '%s ' % str_tab
    str_tab = "%s%s" % (str_tab, str_tabBoundary)
    for i in range(a_tabs):
        str_Indent = '%s%s' % (str_Indent, str_tab)
    str_ret = re.sub('\n', '\n%s' % str_Indent, astr_buf)
    str_ret = '%s%s' % (str_Indent, str_ret)
    if b_trailN: str_ret = str_ret + '\n'
    return str_ret
1127940
def t_INDENTIFIER(t):
    '
    if t.value in reserved:
        t.type = t.value.upper()
        if t.value in reservedMap:
            t.value = reservedMap[t.value]
    elif t.value in strStatment:
        t.type = 'STATEMENT'
    return t
483417
def replace_tab_indent(s, replace="    "):
    
    prefix = get_indent_prefix(s)
    return prefix.replace("\t", replace) + s[len(prefix):]
232785
def str(self, indent=0):
        
        tab = "%*s" % (indent * 3, "")
        result = []
        result.append("%s<%s" % (tab, self.qname()))
        result.append(self.nsdeclarations())
        for a in self.attributes:
            result.append(" %s" % (unicode(a),))
        if self.isempty():
            result.append("/>")
            return "".join(result)
        result.append(">")
        if self.hasText():
            result.append(self.text.escape())
        for c in self.children:
            result.append("\n")
            result.append(c.str(indent + 1))
        if len(self.children):
            result.append("\n%s" % (tab,))
        result.append("</%s>" % (self.qname(),))
        return "".join(result)
558602
String getIndentation()
	{
		StringBuilder sb = new StringBuilder();

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

		return sb.toString();
	}
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