Remove (unused) offset= parameter from deindent()

This commit is contained in:
Anthony Sottile 2018-10-03 13:33:10 -07:00
parent b8b9e8d41c
commit e5ab62b1b6
1 changed files with 4 additions and 11 deletions

View File

@ -110,17 +110,10 @@ class Source(object):
ast, start, end = getstatementrange_ast(lineno, self)
return start, end
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.
"""
# XXX maybe use the tokenizer to properly handle multiline
# strings etc.pp?
def deindent(self):
"""return a new source object deindented."""
newsource = Source()
newsource.lines[:] = deindent(self.lines, offset)
newsource.lines[:] = deindent(self.lines)
return newsource
def isparseable(self, deindent=True):
@ -263,7 +256,7 @@ def getsource(obj, **kwargs):
return Source(strsrc, **kwargs)
def deindent(lines, offset=None):
def deindent(lines):
return textwrap.dedent("\n".join(lines)).splitlines()