diff options
author | Andi Albrecht <albrecht.andi@gmail.com> | 2015-10-26 20:14:18 +0100 |
---|---|---|
committer | Andi Albrecht <albrecht.andi@gmail.com> | 2015-10-26 20:14:18 +0100 |
commit | 1992f6deff983f7a3332142da5c49e82544bd1ac (patch) | |
tree | d76351e66f2502257bf81bdbefcf4fb6fa9c01fe /sqlparse/sql.py | |
parent | f7e07b7b61be4befd5eaafce93aeb0238c884315 (diff) | |
download | sqlparse-1992f6deff983f7a3332142da5c49e82544bd1ac.tar.gz |
Cleanup module code.
Diffstat (limited to 'sqlparse/sql.py')
-rw-r--r-- | sqlparse/sql.py | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/sqlparse/sql.py b/sqlparse/sql.py index 97dd24e..aaf566b 100644 --- a/sqlparse/sql.py +++ b/sqlparse/sql.py @@ -232,7 +232,6 @@ class TokenList(Token): return True def get_sublists(self): -# return [x for x in self.tokens if isinstance(x, TokenList)] for x in self.tokens: if isinstance(x, TokenList): yield x @@ -347,9 +346,9 @@ class TokenList(Token): def token_index(self, token, start=0): """Return list index of token.""" if start > 0: - # Performing `index` manually is much faster when starting in the middle - # of the list of tokens and expecting to find the token near to the starting - # index. + # Performing `index` manually is much faster when starting + # in the middle of the list of tokens and expecting to find + # the token near to the starting index. for i in range(start, len(self.tokens)): if self.tokens[i] == token: return i @@ -471,6 +470,7 @@ class TokenList(Token): return tok.get_name() return None + class Statement(TokenList): """Represents a SQL statement.""" @@ -570,6 +570,7 @@ class SquareBrackets(TokenList): def _groupable_tokens(self): return self.tokens[1:-1] + class Assignment(TokenList): """An assignment like 'var := val;'""" __slots__ = ('value', 'ttype', 'tokens') @@ -672,10 +673,10 @@ class Function(TokenList): for t in parenthesis.tokens: if isinstance(t, IdentifierList): return t.get_identifiers() - elif isinstance(t, Identifier) or \ - isinstance(t, Function) or \ - t.ttype in T.Literal: - return [t,] + elif (isinstance(t, Identifier) or + isinstance(t, Function) or + t.ttype in T.Literal): + return [t, ] return [] |