summaryrefslogtreecommitdiff
path: root/sqlparse/sql.py
diff options
context:
space:
mode:
authorAndreas Albrecht <a.albrecht@Mac-PU08.prounix.local>2019-10-20 17:51:02 +0200
committerAndreas Albrecht <a.albrecht@Mac-PU08.prounix.local>2019-10-20 17:51:02 +0200
commitb8b65c52db6e4ffda18dbce3d4752696b99149a0 (patch)
tree0f6de4b2e1f5e9a2885161034be9bbb753d3482a /sqlparse/sql.py
parent9433666c8c3df8b23f17d7b46d91fd1b9d922b77 (diff)
downloadsqlparse-b8b65c52db6e4ffda18dbce3d4752696b99149a0.tar.gz
Code cleanup.
Diffstat (limited to 'sqlparse/sql.py')
-rw-r--r--sqlparse/sql.py22
1 files changed, 11 insertions, 11 deletions
diff --git a/sqlparse/sql.py b/sqlparse/sql.py
index fbe1c18..15f905e 100644
--- a/sqlparse/sql.py
+++ b/sqlparse/sql.py
@@ -262,15 +262,14 @@ class TokenList(Token):
ignored too.
"""
# this on is inconsistent, using Comment instead of T.Comment...
- funcs = lambda tk: not ((skip_ws and tk.is_whitespace)
- or (skip_cm and imt(tk,
- t=T.Comment, i=Comment)))
- return self._token_matching(funcs)[1]
+ def matcher(tk):
+ return not ((skip_ws and tk.is_whitespace)
+ or (skip_cm and imt(tk, t=T.Comment, i=Comment)))
+ return self._token_matching(matcher)[1]
def token_next_by(self, i=None, m=None, t=None, idx=-1, end=None):
- funcs = lambda tk: imt(tk, i, m, t)
idx += 1
- return self._token_matching(funcs, idx, end)
+ return self._token_matching(lambda tk: imt(tk, i, m, t), idx, end)
def token_not_matching(self, funcs, idx):
funcs = (funcs,) if not isinstance(funcs, (list, tuple)) else funcs
@@ -300,10 +299,11 @@ class TokenList(Token):
if idx is None:
return None, None
idx += 1 # alot of code usage current pre-compensates for this
- funcs = lambda tk: not ((skip_ws and tk.is_whitespace)
- or (skip_cm and imt(tk,
- t=T.Comment, i=Comment)))
- return self._token_matching(funcs, idx, reverse=_reverse)
+
+ def matcher(tk):
+ return not ((skip_ws and tk.is_whitespace)
+ or (skip_cm and imt(tk, t=T.Comment, i=Comment)))
+ return self._token_matching(matcher, idx, reverse=_reverse)
def token_index(self, token, start=0):
"""Return list index of token."""
@@ -490,7 +490,7 @@ class IdentifierList(TokenList):
class TypedLiteral(TokenList):
- """A typed literal (?), such as "date '2001-09-28'" or "interval '2 hours'"."""
+ """A typed literal, such as "date '2001-09-28'" or "interval '2 hours'"."""
M_OPEN = T.Name.Builtin, None
M_CLOSE = T.String.Single, None
M_EXTEND = T.Keyword, ("DAY", "MONTH", "YEAR", "HOUR", "MINUTE", "SECOND")