From 2c96cdc940c166603118cbab3b3589c7b49c978c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jes=C3=BAs=20Legan=C3=A9s=20Combarro=20=22Piranna=22?= Date: Sat, 24 Mar 2012 18:48:27 +0100 Subject: Clean-up --- sqlparse/filters.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'sqlparse') diff --git a/sqlparse/filters.py b/sqlparse/filters.py index cbf6b9e..528a5cb 100644 --- a/sqlparse/filters.py +++ b/sqlparse/filters.py @@ -76,19 +76,22 @@ class StripComments(Filter): def StripWhitespace(stream): "Strip the useless whitespaces from a stream leaving only the minimal ones" last_type = None + ignore_group = Whitespace, Whitespace.Newline, Comparison, Punctuation for token_type, value in stream: # We got a previous token if last_type: print repr(token_type), repr(value) + if token_type in Whitespace: print '\t', repr(token_type), repr(value) - if last_type in (Whitespace, Whitespace.Newline, Comparison, Punctuation): + + if last_type in ignore_group: continue value = ' ' # Ignore first empty spaces and dot-commas - elif token_type in (Whitespace, Whitespace.Newline, Punctuation): + elif token_type in ignore_group: continue yield token_type, value -- cgit v1.2.1