diff options
| author | Victor Uriarte <victor.m.uriarte@intel.com> | 2016-06-16 06:45:09 -0700 |
|---|---|---|
| committer | Victor Uriarte <victor.m.uriarte@intel.com> | 2016-06-18 18:01:40 -0700 |
| commit | 581912d36e2b10191e46fa891dce912693983c95 (patch) | |
| tree | cd09976baec1a96b1efcf1804219cfe40c995114 | |
| parent | 92b5f2bb88ed1c1080ecf7eb7449f5c642ae196a (diff) | |
| download | sqlparse-581912d36e2b10191e46fa891dce912693983c95.tar.gz | |
Misc. small code clean-up/comments
| -rw-r--r-- | sqlparse/cli.py | 1 | ||||
| -rw-r--r-- | sqlparse/engine/grouping.py | 5 | ||||
| -rw-r--r-- | sqlparse/lexer.py | 2 |
3 files changed, 4 insertions, 4 deletions
diff --git a/sqlparse/cli.py b/sqlparse/cli.py index 1009413..03a4f8f 100644 --- a/sqlparse/cli.py +++ b/sqlparse/cli.py @@ -134,6 +134,7 @@ def main(args=None): data = sys.stdin.read() else: try: + # TODO: Needs to deal with encoding data = ''.join(open(args.filename).readlines()) except IOError as e: _error('Failed to read %s: %s' % (args.filename, e)) diff --git a/sqlparse/engine/grouping.py b/sqlparse/engine/grouping.py index 62f37a6..d5b5c4f 100644 --- a/sqlparse/engine/grouping.py +++ b/sqlparse/engine/grouping.py @@ -217,14 +217,13 @@ def group_operator(tlist): def group_identifier_list(tlist): m_role = T.Keyword, ('null', 'role') - m_comma = T.Punctuation, ',' sqlcls = (sql.Function, sql.Case, sql.Identifier, sql.Comparison, sql.IdentifierList, sql.Operation) ttypes = (T_NUMERICAL + T_STRING + T_NAME + (T.Keyword, T.Comment, T.Wildcard)) def match(token): - return imt(token, m=m_comma) + return token.match(T.Punctuation, ',') def valid(token): return imt(token, i=sqlcls, m=m_role, t=ttypes) @@ -275,7 +274,7 @@ def group_aliased(tlist): tidx, token = tlist.token_next_by(i=I_ALIAS, t=T.Number) while token: nidx, next_ = tlist.token_next(tidx) - if imt(next_, i=sql.Identifier): + if isinstance(next_, sql.Identifier): tlist.group_tokens(sql.Identifier, tidx, nidx, extend=True) tidx, token = tlist.token_next_by(i=I_ALIAS, t=T.Number, idx=tidx) diff --git a/sqlparse/lexer.py b/sqlparse/lexer.py index 0fb8936..6324962 100644 --- a/sqlparse/lexer.py +++ b/sqlparse/lexer.py @@ -20,7 +20,7 @@ from sqlparse.utils import consume class Lexer(object): """Lexer - Empty class. Leaving for back-support + Empty class. Leaving for backwards-compatibility """ @staticmethod |
