summaryrefslogtreecommitdiff
path: root/sqlparse/engine/grouping.py
diff options
context:
space:
mode:
authorAndi Albrecht <albrecht.andi@gmail.com>2016-06-03 19:07:47 +0200
committerAndi Albrecht <albrecht.andi@gmail.com>2016-06-03 19:07:47 +0200
commit8d78d7337724a929aff5abc2e4657713a02df7cc (patch)
tree9dd97e37e57964120187acb7229af9001bdbdc69 /sqlparse/engine/grouping.py
parenta767c88b008d407d91b9118d124e2a9b579a7f12 (diff)
parent81e408a4f2c8281e0da7c93ed75da90df1a518e2 (diff)
downloadsqlparse-8d78d7337724a929aff5abc2e4657713a02df7cc.tar.gz
Merge pull request #244 from vmuriart/refactor
Change old-style class to new-style & remove unused function
Diffstat (limited to 'sqlparse/engine/grouping.py')
-rw-r--r--sqlparse/engine/grouping.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/sqlparse/engine/grouping.py b/sqlparse/engine/grouping.py
index f7953e7..7a93b5e 100644
--- a/sqlparse/engine/grouping.py
+++ b/sqlparse/engine/grouping.py
@@ -27,15 +27,16 @@ def _group_left_right(tlist, m, cls,
if valid_left(left) and valid_right(right):
if semicolon:
+ # only overwrite if a semicolon present.
sright = tlist.token_next_by(m=M_SEMICOLON, idx=right)
- right = sright or right # only overwrite if a semicolon present.
+ right = sright or right
tokens = tlist.tokens_between(left, right)
token = tlist.group_tokens(cls, tokens, extend=True)
token = tlist.token_next_by(m=m, idx=token)
def _group_matching(tlist, cls):
- """Groups Tokens that have beginning and end. ie. parenthesis, brackets.."""
+ """Groups Tokens that have beginning and end."""
idx = 1 if imt(tlist, i=cls) else 0
token = tlist.token_next_by(m=cls.M_OPEN, idx=idx)
@@ -223,9 +224,9 @@ def group_functions(tlist):
has_create = False
has_table = False
for tmp_token in tlist.tokens:
- if tmp_token.value == u'CREATE':
+ if tmp_token.value == 'CREATE':
has_create = True
- if tmp_token.value == u'TABLE':
+ if tmp_token.value == 'TABLE':
has_table = True
if has_create and has_table:
return