Skip to content

Commit 228059e

Browse files
committed
remove group left_right
1 parent d6763dc commit 228059e

1 file changed

Lines changed: 0 additions & 27 deletions

File tree

sqlparse/engine/grouping.py

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -63,33 +63,6 @@ def group_begin(tlist):
6363
_group_matching(tlist, sql.Begin)
6464

6565

66-
def _group_left_right(tlist, m, cls,
67-
valid_left=lambda t: t is not None,
68-
valid_right=lambda t: t is not None,
69-
semicolon=False):
70-
"""Groups together tokens that are joined by a middle token. ie. x < y"""
71-
for token in list(tlist):
72-
if token.is_group() and not isinstance(token, cls):
73-
_group_left_right(token, m, cls, valid_left, valid_right,
74-
semicolon)
75-
continue
76-
if not token.match(*m):
77-
continue
78-
79-
tidx = tlist.token_index(token)
80-
pidx, prev_ = tlist.token_prev(tidx)
81-
nidx, next_ = tlist.token_next(tidx)
82-
83-
if valid_left(prev_) and valid_right(next_):
84-
if semicolon:
85-
# only overwrite if a semicolon present.
86-
m_semicolon = T.Punctuation, ';'
87-
snidx, _ = tlist.token_next_by(m=m_semicolon, idx=nidx)
88-
nidx = snidx or nidx
89-
# Luckily, this leaves the position of `token` intact.
90-
tlist.group_tokens(cls, pidx, nidx, extend=True)
91-
92-
9366
def group_typecasts(tlist):
9467
def match(token):
9568
return token.match(T.Punctuation, '::')

0 commit comments

Comments
 (0)