Skip to content

Commit 581912d

Browse files
committed
Misc. small code clean-up/comments
1 parent 92b5f2b commit 581912d

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

sqlparse/cli.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,7 @@ def main(args=None):
134134
data = sys.stdin.read()
135135
else:
136136
try:
137+
# TODO: Needs to deal with encoding
137138
data = ''.join(open(args.filename).readlines())
138139
except IOError as e:
139140
_error('Failed to read %s: %s' % (args.filename, e))

sqlparse/engine/grouping.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -217,14 +217,13 @@ def post(tlist, pidx, tidx, nidx):
217217

218218
def group_identifier_list(tlist):
219219
m_role = T.Keyword, ('null', 'role')
220-
m_comma = T.Punctuation, ','
221220
sqlcls = (sql.Function, sql.Case, sql.Identifier, sql.Comparison,
222221
sql.IdentifierList, sql.Operation)
223222
ttypes = (T_NUMERICAL + T_STRING + T_NAME +
224223
(T.Keyword, T.Comment, T.Wildcard))
225224

226225
def match(token):
227-
return imt(token, m=m_comma)
226+
return token.match(T.Punctuation, ',')
228227

229228
def valid(token):
230229
return imt(token, i=sqlcls, m=m_role, t=ttypes)
@@ -275,7 +274,7 @@ def group_aliased(tlist):
275274
tidx, token = tlist.token_next_by(i=I_ALIAS, t=T.Number)
276275
while token:
277276
nidx, next_ = tlist.token_next(tidx)
278-
if imt(next_, i=sql.Identifier):
277+
if isinstance(next_, sql.Identifier):
279278
tlist.group_tokens(sql.Identifier, tidx, nidx, extend=True)
280279
tidx, token = tlist.token_next_by(i=I_ALIAS, t=T.Number, idx=tidx)
281280

sqlparse/lexer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
class Lexer(object):
2222
"""Lexer
23-
Empty class. Leaving for back-support
23+
Empty class. Leaving for backwards-compatibility
2424
"""
2525

2626
@staticmethod

0 commit comments

Comments
 (0)