code.Source API [rev. unknown]

class Source(object):

a mutable object holding a source code fragment, possibly deindenting it.

methods:

def __init__(self, *parts, **kwargs):

*no docstring available*

def compile(self, filename=None, mode='exec', flag=0, dont_inherit=0):

return compiled code object. if filename is None invent an artificial filename which displays the source/line position of the caller frame.

def deindent(self, offset=None):

return a new source object deindented by offset. If offset is None then guess an indentation offset from the first non-blank line. Subsequent lines which have a lower indentation offset will be copied verbatim as they are assumed to be part of multilines.

def getblockend(self, lineno):

*no docstring available*

def getstatement(self, lineno):

return Source statement which contains the given linenumber (counted from 0).

def getstatementrange(self, lineno):

return (start, end) tuple which spans the minimal statement region which containing the given lineno.

def indent(self, indent=' '):

return a copy of the source object with all lines indented by the given indent-string.

def isparseable(self, deindent=True):

return True if source is parseable, heuristically deindenting it by default.

def putaround(self, before='', after='', indent=' '):

return a copy of the source object with 'before' and 'after' wrapped around it.

def strip(self):

return new source object with trailing and leading blank lines removed.

def __eq__(self, other):

*no docstring available*

def __getitem__(self, key):

*no docstring available*

def __getslice__(self, start, end):

*no docstring available*

def __len__(self):

def __str__(self):

*no docstring available*