summaryrefslogtreecommitdiff
path: root/sqlparse
diff options
context:
space:
mode:
authorVictor Uriarte <victor.m.uriarte@intel.com>2016-06-07 22:16:51 -0700
committerVictor Uriarte <victor.m.uriarte@intel.com>2016-06-09 20:37:20 -0700
commit9ab51d65524f3816a705fdd98a8aed60ad38fe5c (patch)
tree64436dd6a14d24c553206168d979a3300835659b /sqlparse
parent5468b0a14e082c07c5db4f9d3c7f157c1df920a3 (diff)
downloadsqlparse-9ab51d65524f3816a705fdd98a8aed60ad38fe5c.tar.gz
Remove redundant token
no point in returning tk to remove it right after
Diffstat (limited to 'sqlparse')
-rw-r--r--sqlparse/filters/reindent.py11
1 files changed, 5 insertions, 6 deletions
diff --git a/sqlparse/filters/reindent.py b/sqlparse/filters/reindent.py
index 8b3f7fa..994f0aa 100644
--- a/sqlparse/filters/reindent.py
+++ b/sqlparse/filters/reindent.py
@@ -27,9 +27,9 @@ class ReindentFilter(object):
token = next(token.flatten())
for t in self._curr_stmt.flatten():
- yield t
if t == token:
raise StopIteration
+ yield t
def _get_offset(self, token):
raw = ''.join(map(text_type, self._flatten_up_to_token(token)))
@@ -100,14 +100,13 @@ class ReindentFilter(object):
with indent(self, 1 if is_DML_DLL else 0):
tlist.tokens.insert(0, self.nl()) if is_DML_DLL else None
- with offset(self, self._get_offset(first)): # +1 from ( removed
+ with offset(self, self._get_offset(first) + 1):
self._process_default(tlist, not is_DML_DLL)
def _process_identifierlist(self, tlist):
identifiers = list(tlist.get_identifiers())
first = next(identifiers.pop(0).flatten())
- num_offset = 1 if self.char == '\t' else (self._get_offset(first) -
- len(first.value))
+ num_offset = 1 if self.char == '\t' else self._get_offset(first)
if not tlist.within(sql.Function):
with offset(self, num_offset):
position = 0
@@ -124,8 +123,8 @@ class ReindentFilter(object):
cond, _ = next(iterable)
first = next(cond[0].flatten())
- with offset(self, self._get_offset(tlist[0]) - len(tlist[0].value)):
- with offset(self, self._get_offset(first) - len(first.value)):
+ with offset(self, self._get_offset(tlist[0])):
+ with offset(self, self._get_offset(first)):
for cond, value in iterable:
token = value[0] if cond is None else cond[0]
tlist.insert_before(token, self.nl())