Upstream andialbrecht/sqlparse state of the touched files before f47b549867
This commit is contained in:
1 parent
f0a09a4a1b
commit
40155f3cf6
4 files changed
+9
-58
No files matched your search
@@ -63,20 +63,8 @@ class StripCommentsFilter:
|
||||
):
|
||||
# Insert a whitespace to ensure the following SQL produces
|
||||
# a valid SQL (see #425).
|
||||
insert_tok = _get_insert_token(token)
|
||||
# A plain space separator is redundant when a neighbour is
|
||||
# already whitespace, which happens for comments interleaved
|
||||
# inside a grouped identifier. A line break carried by the
|
||||
# comment is always kept.
|
||||
redundant_space = (
|
||||
insert_tok.is_whitespace and not insert_tok.is_newline
|
||||
and ((prev_ is not None and prev_.is_whitespace)
|
||||
or (next_ is not None and next_.is_whitespace))
|
||||
)
|
||||
if (prev_ is not None
|
||||
and not prev_.match(T.Punctuation, '(')
|
||||
and not redundant_space):
|
||||
tlist.tokens.insert(tidx, insert_tok)
|
||||
if prev_ is not None and not prev_.match(T.Punctuation, '('):
|
||||
tlist.tokens.insert(tidx, _get_insert_token(token))
|
||||
tlist.tokens.remove(token)
|
||||
tidx -= 1
|
||||
else:
|
||||
|
||||
Reference in new issue
Block a user