Skip to content

Commit 711744d

Browse files
committed
Remove functions no-longer used
1 parent a795be1 commit 711744d

2 files changed

Lines changed: 0 additions & 63 deletions

File tree

sqlparse/sql.py

Lines changed: 0 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -226,27 +226,6 @@ def _token_idx_matching(self, funcs, start=0, end=None, reverse=False):
226226
return idx, token
227227
return None, None
228228

229-
def _token_matching(self, funcs, start=0, end=None, reverse=False):
230-
"""next token that match functions"""
231-
if start is None:
232-
return None
233-
234-
if not isinstance(start, int):
235-
start = self.token_index(start) + 1
236-
237-
if not isinstance(funcs, (list, tuple)):
238-
funcs = (funcs,)
239-
240-
if reverse:
241-
iterable = reversed(self.tokens[end:start - 1])
242-
else:
243-
iterable = self.tokens[start:end]
244-
245-
for token in iterable:
246-
for func in funcs:
247-
if func(token):
248-
return token
249-
250229
def token_first(self, skip_ws=True, skip_cm=False):
251230
"""Returns the first child token.
252231
@@ -265,10 +244,6 @@ def token_idx_next_by(self, i=None, m=None, t=None, idx=0, end=None):
265244
funcs = lambda tk: imt(tk, i, m, t)
266245
return self._token_idx_matching(funcs, idx, end)
267246

268-
def token_next_by(self, i=None, m=None, t=None, idx=0, end=None):
269-
funcs = lambda tk: imt(tk, i, m, t)
270-
return self._token_matching(funcs, idx, end)
271-
272247
def token_not_matching(self, funcs, idx):
273248
funcs = (funcs,) if not isinstance(funcs, (list, tuple)) else funcs
274249
funcs = [lambda tk: not func(tk) for func in funcs]
@@ -290,32 +265,6 @@ def token_idx_prev(self, idx, skip_ws=True, skip_cm=False):
290265
(skip_cm and imt(tk, t=T.Comment, i=Comment)))
291266
return self._token_idx_matching(funcs, idx, reverse=True)
292267

293-
def token_prev(self, idx=0, skip_ws=True, skip_cm=False):
294-
"""Returns the previous token relative to *idx*.
295-
296-
If *skip_ws* is ``True`` (the default) whitespace tokens are ignored.
297-
``None`` is returned if there's no previous token.
298-
"""
299-
if isinstance(idx, int):
300-
idx += 1 # alot of code usage current pre-compensates for this
301-
funcs = lambda tk: not ((skip_ws and tk.is_whitespace()) or
302-
(skip_cm and imt(tk, t=T.Comment, i=Comment)))
303-
return self._token_matching(funcs, idx, reverse=True)
304-
305-
def token_next(self, idx=0, skip_ws=True, skip_cm=False):
306-
"""Returns the next token relative to *idx*.
307-
308-
If called with idx = 0. Returns the first child token.
309-
If *skip_ws* is ``True`` (the default) whitespace tokens are ignored.
310-
If *skip_cm* is ``True`` (default: ``False``), comments are ignored.
311-
``None`` is returned if there's no next token.
312-
"""
313-
if isinstance(idx, int):
314-
idx += 1 # alot of code usage current pre-compensates for this
315-
funcs = lambda tk: not ((skip_ws and tk.is_whitespace()) or
316-
(skip_cm and imt(tk, t=T.Comment, i=Comment)))
317-
return self._token_matching(funcs, idx)
318-
319268
# TODO: May need to implement skip_cm for upstream changes.
320269
# TODO: May need to re-add default value to idx
321270
def token_idx_next(self, idx, skip_ws=True, skip_cm=False):

sqlparse/utils.py

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -103,18 +103,6 @@ def imt(token, i=None, m=None, t=None):
103103
return False
104104

105105

106-
def find_matching(tlist, token, open_pattern, close_pattern):
107-
idx = tlist.token_index(token) if not isinstance(token, int) else token
108-
depth = 0
109-
for token in tlist.tokens[idx:]:
110-
if token.match(*open_pattern):
111-
depth += 1
112-
elif token.match(*close_pattern):
113-
depth -= 1
114-
if depth == 0:
115-
return token
116-
117-
118106
def consume(iterator, n):
119107
"""Advance the iterator n-steps ahead. If n is none, consume entirely."""
120108
deque(itertools.islice(iterator, n), maxlen=0)

0 commit comments

Comments
 (0)