Skip to content

Commit bcaf326

Browse files
committed
Code cleanup.
1 parent 3bf54c1 commit bcaf326

3 files changed

Lines changed: 9 additions & 6 deletions

File tree

sqlparse/engine/filter.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,14 +61,15 @@ def _change_splitlevel(self, ttype, value):
6161
if unified == 'END':
6262
# Should this respect a preceeding BEGIN?
6363
# In CASE ... WHEN ... END this results in a split level -1.
64-
self._begin_depth = max(0, self._begin_depth-1)
64+
self._begin_depth = max(0, self._begin_depth - 1)
6565
return -1
6666

6767
if ttype is T.Keyword.DDL and unified.startswith('CREATE'):
6868
self._is_create = True
6969
return 0
7070

71-
if unified in ('IF', 'FOR') and self._is_create and self._begin_depth > 0:
71+
if (unified in ('IF', 'FOR')
72+
and self._is_create and self._begin_depth > 0):
7273
return 1
7374

7475
# Default

sqlparse/engine/grouping.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -267,13 +267,15 @@ def group_aliased(tlist):
267267
token = tlist.token_next_by_instance(idx, (sql.Identifier, sql.Function))
268268
while token:
269269
next_ = tlist.token_next(tlist.token_index(token))
270-
if next_ is not None and isinstance(next_, (sql.Identifier, sql.Function)):
270+
if next_ is not None and isinstance(next_,
271+
(sql.Identifier, sql.Function)):
271272
grp = tlist.tokens_between(token, next_)[1:]
272273
token.tokens.extend(grp)
273274
for t in grp:
274275
tlist.tokens.remove(t)
275276
idx = tlist.token_index(token) + 1
276-
token = tlist.token_next_by_instance(idx, (sql.Identifier, sql.Function))
277+
token = tlist.token_next_by_instance(idx,
278+
(sql.Identifier, sql.Function))
277279

278280

279281
def group_typecasts(tlist):

sqlparse/sql.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ def _get_repr_name(self):
146146

147147
def _pprint_tree(self, max_depth=None, depth=0):
148148
"""Pretty-print the object tree."""
149-
indent = ' '*(depth*2)
149+
indent = ' ' * (depth * 2)
150150
for idx, token in enumerate(self.tokens):
151151
if token.is_group():
152152
pre = ' +-'
@@ -156,7 +156,7 @@ def _pprint_tree(self, max_depth=None, depth=0):
156156
token._get_repr_name(),
157157
token._get_repr_value())
158158
if (token.is_group() and (max_depth is None or depth < max_depth)):
159-
token._pprint_tree(max_depth, depth+1)
159+
token._pprint_tree(max_depth, depth + 1)
160160

161161
def flatten(self):
162162
"""Generator yielding ungrouped tokens.

0 commit comments

Comments
 (0)