Skip to content

Commit 210dce4

Browse files
committed
Merge pull request andialbrecht#65 from piranna/master
parse() and parsestream() unification
2 parents 5cc2604 + 28f9c77 commit 210dce4

File tree

3 files changed

+6
-8
lines changed

3 files changed

+6
-8
lines changed

AUTHORS

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,5 @@ This module contains code (namely the lexer and filter mechanism) from
44
the pygments project that was written by Georg Brandl.
55

66
Alphabetical list of contributors:
7-
* Jesús Leganés Combarro
8-
9-
7+
* Jesús Leganés Combarro "Piranna" <[email protected]>
8+

sqlparse/__init__.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,11 @@ def parse(sql):
2626
2727
Returns a tuple of :class:`~sqlparse.sql.Statement` instances.
2828
"""
29-
stack = engine.FilterStack()
30-
stack.full_analyze()
31-
return tuple(stack.run(sql))
29+
return tuple(parsestream(sql))
3230

3331

3432
def parsestream(stream):
35-
"""Pares sql statements from file-like object.
33+
"""Parse sql statements from file-like object.
3634
3735
Returns a generator of Statement instances.
3836
"""

sqlparse/filters.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ def _stripws_parenthesis(self, tlist):
219219
self._stripws_default(tlist)
220220

221221
def process(self, stack, stmt, depth=0):
222-
[self.process(stack, sgroup, depth+1)
222+
[self.process(stack, sgroup, depth + 1)
223223
for sgroup in stmt.get_sublists()]
224224
self._stripws(stmt)
225225
if depth == 0 and stmt.tokens[-1].is_whitespace():
@@ -493,6 +493,7 @@ def process(self, stack, stmt):
493493
res += '\n'
494494
return res
495495

496+
496497
def Tokens2Unicode(stream):
497498
result = ""
498499

0 commit comments

Comments
 (0)