MCPcopy
hub / github.com/andialbrecht/sqlparse / split_unquoted_newlines

Function split_unquoted_newlines

sqlparse/utils.py:36–51  ·  view source on GitHub ↗

Split a string on all unquoted newlines. Unlike str.splitlines(), this will ignore CR/LF/CR+LF if the requisite character is inside of a string.

(stmt)

Source from the content-addressed store, hash-verified

34
35
36def split_unquoted_newlines(stmt):
37 """Split a string on all unquoted newlines.
38
39 Unlike str.splitlines(), this will ignore CR/LF/CR+LF if the requisite
40 character is inside of a string."""
41 text = str(stmt)
42 lines = SPLIT_REGEX.split(text)
43 outputlines = ['']
44 for line in lines:
45 if not line:
46 continue
47 elif LINE_MATCH.match(line):
48 outputlines.append('')
49 else:
50 outputlines[-1] += line
51 return outputlines
52
53
54def remove_quotes(val):

Callers 1

processMethod · 0.90

Calls 1

matchMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…