summaryrefslogtreecommitdiff
path: root/sqlparse/engine/grouping.py
diff options
context:
space:
mode:
authorAndi Albrecht <albrecht.andi@gmail.com>2015-10-26 20:14:18 +0100
committerAndi Albrecht <albrecht.andi@gmail.com>2015-10-26 20:14:18 +0100
commit1992f6deff983f7a3332142da5c49e82544bd1ac (patch)
treed76351e66f2502257bf81bdbefcf4fb6fa9c01fe /sqlparse/engine/grouping.py
parentf7e07b7b61be4befd5eaafce93aeb0238c884315 (diff)
downloadsqlparse-1992f6deff983f7a3332142da5c49e82544bd1ac.tar.gz
Cleanup module code.
Diffstat (limited to 'sqlparse/engine/grouping.py')
-rw-r--r--sqlparse/engine/grouping.py12
1 files changed, 7 insertions, 5 deletions
diff --git a/sqlparse/engine/grouping.py b/sqlparse/engine/grouping.py
index c8c2415..fe8b2e8 100644
--- a/sqlparse/engine/grouping.py
+++ b/sqlparse/engine/grouping.py
@@ -116,7 +116,7 @@ def group_as(tlist):
def _right_valid(token):
# Currently limited to DML/DDL. Maybe additional more non SQL reserved
# keywords should appear here (see issue8).
- return not token.ttype in (T.DML, T.DDL)
+ return token.ttype not in (T.DML, T.DDL)
def _left_valid(token):
if token.ttype is T.Keyword and token.value in ('NULL',):
@@ -191,7 +191,8 @@ def group_identifier(tlist):
i1 = tl.token_index(t1, start=i) if t1 else None
t2_end = None if i1 is None else i1 + 1
- t2 = tl.token_next_by_instance(i, (sql.Function, sql.Parenthesis), end=t2_end)
+ t2 = tl.token_next_by_instance(i, (sql.Function, sql.Parenthesis),
+ end=t2_end)
if t1 and t2:
i2 = tl.token_index(t2, start=i)
@@ -219,9 +220,10 @@ def group_identifier(tlist):
if identifier_tokens and identifier_tokens[-1].ttype is T.Whitespace:
identifier_tokens = identifier_tokens[:-1]
if not (len(identifier_tokens) == 1
- and (isinstance(identifier_tokens[0], (sql.Function, sql.Parenthesis))
- or identifier_tokens[0].ttype in (T.Literal.Number.Integer,
- T.Literal.Number.Float))):
+ and (isinstance(identifier_tokens[0], (sql.Function,
+ sql.Parenthesis))
+ or identifier_tokens[0].ttype in (
+ T.Literal.Number.Integer, T.Literal.Number.Float))):
group = tlist.group_tokens(sql.Identifier, identifier_tokens)
idx = tlist.token_index(group, start=idx) + 1
else: