diff options
Diffstat (limited to 'sqlparse/engine/grouping.py')
-rw-r--r-- | sqlparse/engine/grouping.py | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/sqlparse/engine/grouping.py b/sqlparse/engine/grouping.py index a317044..12ae385 100644 --- a/sqlparse/engine/grouping.py +++ b/sqlparse/engine/grouping.py @@ -5,11 +5,6 @@ import itertools from sqlparse import sql from sqlparse import tokens as T -try: - next -except NameError: # Python < 2.6 - next = lambda i: i.next() - def _group_left_right(tlist, ttype, value, cls, check_right=lambda t: True, @@ -116,7 +111,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',): @@ -216,9 +211,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) + 1 else: @@ -451,6 +447,5 @@ def group(tlist): group_if, group_for, group_foreach, - group_begin, - ]: + group_begin]: func(tlist) |