1
0
forked from VimPlug/jedi

new splitlines implementation to get rid of the ugly splitlines we now have as well as (partially) the issue with form feeds

This commit is contained in:
Dave Halter
2014-07-18 16:52:55 +02:00
parent 0f665bf436
commit ffaacbefbc
2 changed files with 11 additions and 3 deletions

View File

@@ -146,3 +146,13 @@ def source_to_unicode(source, encoding=None):
# cast to unicode by default
return unicode(source, detect_encoding(), 'replace')
def splitlines(string):
"""
A splitlines for Python code. In contrast to Python's ``str.splitlines``,
looks at form feeds and other special characters as normal text. Just
splits ``\n`` and ``\r\n``.
Also different: Returns ``['']`` for an empty string input.
"""
return re.split('\n|\r\n', string)