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) ast, start, end = getstatementrange_ast(lineno, self)
return start, end return start, end
def deindent(self, offset=None): def deindent(self):
""" return a new source object deindented by offset. """return a new source object deindented."""
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?
newsource = Source() newsource = Source()
newsource.lines[:] = deindent(self.lines, offset) newsource.lines[:] = deindent(self.lines)
return newsource return newsource
def isparseable(self, deindent=True): def isparseable(self, deindent=True):
@ -263,7 +256,7 @@ def getsource(obj, **kwargs):
return Source(strsrc, **kwargs) return Source(strsrc, **kwargs)
def deindent(lines, offset=None): def deindent(lines):
return textwrap.dedent("\n".join(lines)).splitlines() return textwrap.dedent("\n".join(lines)).splitlines()