Skip to content

Commit 5ce2255

Browse files
committed
Remove as parameter stack in filter.process
1 parent 62423c0 commit 5ce2255

3 files changed

Lines changed: 22 additions & 22 deletions

File tree

sqlparse/engine/__init__.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,12 @@ def run(self, sql, encoding=None):
2929
# Process token stream
3030
if self.preprocess:
3131
for filter_ in self.preprocess:
32-
stream = filter_.process(self, stream)
32+
stream = filter_.process(stream)
3333

3434
if (self.stmtprocess or self.postprocess or
3535
self.split_statements or self._grouping):
3636
splitter = StatementFilter()
37-
stream = splitter.process(self, stream)
37+
stream = splitter.process(stream)
3838

3939
if self._grouping:
4040

@@ -50,7 +50,7 @@ def _run1(stream):
5050
ret = []
5151
for stmt in stream:
5252
for filter_ in self.stmtprocess:
53-
filter_.process(self, stmt)
53+
filter_.process(stmt)
5454
ret.append(stmt)
5555
return ret
5656
stream = _run1(stream)
@@ -61,7 +61,7 @@ def _run2(stream):
6161
for stmt in stream:
6262
stmt.tokens = list(stmt.flatten())
6363
for filter_ in self.postprocess:
64-
stmt = filter_.process(self, stmt)
64+
stmt = filter_.process(stmt)
6565
yield stmt
6666
stream = _run2(stream)
6767

sqlparse/engine/filter.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ def _change_splitlevel(self, ttype, value):
7676
# Default
7777
return 0
7878

79-
def process(self, stack, stream):
79+
def process(self, stream):
8080
"Process the stream"
8181
consume_ws = False
8282
splitlevel = 0

sqlparse/filters.py

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ def __init__(self, case=None):
2525
assert case in ['lower', 'upper', 'capitalize']
2626
self.convert = getattr(text_type, case)
2727

28-
def process(self, stack, stream):
28+
def process(self, stream):
2929
for ttype, value in stream:
3030
if ttype in self.ttype:
3131
value = self.convert(value)
@@ -39,7 +39,7 @@ class KeywordCaseFilter(_CaseFilter):
3939
class IdentifierCaseFilter(_CaseFilter):
4040
ttype = (T.Name, T.String.Symbol)
4141

42-
def process(self, stack, stream):
42+
def process(self, stream):
4343
for ttype, value in stream:
4444
if ttype in self.ttype and not value.strip()[0] == '"':
4545
value = self.convert(value)
@@ -52,7 +52,7 @@ def __init__(self, width, char):
5252
self.width = max(width, 1)
5353
self.char = u(char)
5454

55-
def process(self, stack, stream):
55+
def process(self, stream):
5656
for ttype, value in stream:
5757
if ttype is T.Literal.String.Single:
5858
if value[:2] == '\'\'':
@@ -94,8 +94,8 @@ def _process(self, tlist):
9494
tlist.tokens.pop(tidx)
9595
token = self._get_next_comment(tlist)
9696

97-
def process(self, stack, stmt):
98-
[self.process(stack, sgroup) for sgroup in stmt.get_sublists()]
97+
def process(self, stmt):
98+
[self.process(sgroup) for sgroup in stmt.get_sublists()]
9999
self._process(stmt)
100100

101101

@@ -139,8 +139,8 @@ def _stripws_parenthesis(self, tlist):
139139
tlist.tokens.pop(-2)
140140
self._stripws_default(tlist)
141141

142-
def process(self, stack, stmt, depth=0):
143-
[self.process(stack, sgroup, depth + 1)
142+
def process(self, stmt, depth=0):
143+
[self.process(sgroup, depth + 1)
144144
for sgroup in stmt.get_sublists()]
145145
self._stripws(stmt)
146146
if (
@@ -334,7 +334,7 @@ def _process_default(self, tlist, stmts=True, kwds=True):
334334
self._split_kwds(tlist)
335335
[self._process(sgroup) for sgroup in tlist.get_sublists()]
336336

337-
def process(self, stack, stmt):
337+
def process(self, stmt):
338338
if isinstance(stmt, sql.Statement):
339339
self._curr_stmt = stmt
340340
self._process(stmt)
@@ -350,7 +350,7 @@ def process(self, stack, stmt):
350350
self._last_stmt = stmt
351351

352352

353-
# FIXME: Doesn't work ;)
353+
# FIXME: Doesn't work
354354
class RightMarginFilter(object):
355355

356356
keep_together = (
@@ -361,7 +361,7 @@ def __init__(self, width=79):
361361
self.width = width
362362
self.line = ''
363363

364-
def _process(self, stack, group, stream):
364+
def _process(self, group, stream):
365365
for token in stream:
366366
if token.is_whitespace() and '\n' in token.value:
367367
if token.value.endswith('\n'):
@@ -370,7 +370,7 @@ def _process(self, stack, group, stream):
370370
self.line = token.value.splitlines()[-1]
371371
elif (token.is_group()
372372
and token.__class__ not in self.keep_together):
373-
token.tokens = self._process(stack, token, token.tokens)
373+
token.tokens = self._process(token, token.tokens)
374374
else:
375375
val = u(token)
376376
if len(self.line) + len(val) > self.width:
@@ -384,17 +384,17 @@ def _process(self, stack, group, stream):
384384
self.line += val
385385
yield token
386386

387-
def process(self, stack, group):
388-
return
389-
group.tokens = self._process(stack, group, group.tokens)
390-
387+
def process(self, group):
388+
# return
389+
# group.tokens = self._process(group, group.tokens)
390+
raise NotImplementedError
391391

392392
# ---------------------------
393393
# postprocess
394394

395395
class SerializerUnicode(object):
396396

397-
def process(self, stack, stmt):
397+
def process(self, stmt):
398398
raw = u(stmt)
399399
lines = split_unquoted_newlines(raw)
400400
res = '\n'.join(line.rstrip() for line in lines)
@@ -411,7 +411,7 @@ def __init__(self, varname='sql'):
411411
def _process(self, stream, varname, has_nl):
412412
raise NotImplementedError
413413

414-
def process(self, stack, stmt):
414+
def process(self, stmt):
415415
self.count += 1
416416
if self.count > 1:
417417
varname = '%s%d' % (self.varname, self.count)

0 commit comments

Comments
 (0)