Did I find the right examples for you? yes no

All Samples(12)  |  Call(11)  |  Derive(0)  |  Import(1)
Return the indent size, in spaces, at the start of a line of text.

        def indentsize(line):
    """Return the indent size, in spaces, at the start of a line of text."""
    expline = string.expandtabs(line)
    return len(expline) - len(string.lstrip(expline))

src/d/i/dill-HEAD/dill/source.py   dill(Download)
from inspect import ismodule, isclass, ismethod, isfunction, istraceback
from inspect import isframe, iscode, getfile, getmodule, getsourcefile
from inspect import getblock, indentsize, isbuiltin
from .dill import PY3
        return True
    # check indentsize
    if not indentsize(line): return False #FIXME: is this a good check???
    # check if code 'pattern' matches
    #XXX: or pattern match against dis.dis(code)? (or use uncompyle2?)
    #XXX: 'enclosing' means: closures only? or classes and files?
    indent = indentsize(lines[lnum])
    block = getblock(lines[lnum:]) #XXX: catch any TokenError here?
                try: code = getblock(lines[line:])
                except TokenError: code = [lines[line]]
            if indentsize(lines[line]) > indent: #XXX: should be >= ?
                line += len(code) - skip
            elif target in ''.join(code):
def indent(code, spaces=4):
    '''indent a block of code with whitespace (default is 4 spaces)'''
    indent = indentsize(code) 
    if type(spaces) is int: spaces = ' '*spaces
    # if '\t' is provided, will indent with a tab

src/k/a/kabaret.core-0.1.0b3/kabaret/core/apphost/__init__.py   kabaret.core(Download)
    def _func_to_code(self, func):
        lines = inspect.getsourcelines(func)[0]
        indent = inspect.indentsize(lines[0])
        code = ''.join([ i[indent:] for i in lines ])
        return code

src/n/a/nagare-0.4.1/nagare/ajax.py   nagare(Download)
            self.name += o.func_name
            indent = inspect.indentsize(src)
            src = ''.join([s.expandtabs()[indent:] for s in src.splitlines(True)])