Rename variable s -> text.
This commit is contained in:
parent
adc4247efd
commit
2cb443cf6d
1 changed files with 7 additions and 7 deletions
|
@ -1,23 +1,23 @@
|
||||||
import re
|
import re
|
||||||
import unicodedata
|
import unicodedata
|
||||||
|
|
||||||
def collapse_whitespace(s):
|
def collapse_whitespace(text):
|
||||||
'''
|
'''
|
||||||
Replace all whitespace sequences with a single space and strip the ends.
|
Replace all whitespace sequences with a single space and strip the ends.
|
||||||
'''
|
'''
|
||||||
s = re.sub(r'\s+', ' ', s.strip())
|
text = re.sub(r'\s+', ' ', text.strip())
|
||||||
return s
|
return text
|
||||||
|
|
||||||
def comma_space_split(s):
|
def comma_space_split(text):
|
||||||
'''
|
'''
|
||||||
Split the string by commas and spaces, discarding all extra
|
Split the string by commas and spaces, discarding all extra
|
||||||
whitespace and blank parts.
|
whitespace and blank parts.
|
||||||
|
|
||||||
'a b, c,,d' -> ['a', 'b', 'c', 'd']
|
'a b, c,,d' -> ['a', 'b', 'c', 'd']
|
||||||
'''
|
'''
|
||||||
if s is None:
|
if text is None:
|
||||||
return s
|
return text
|
||||||
return re.split(r'[ ,]+', s.strip())
|
return re.split(r'[ ,]+', text.strip())
|
||||||
|
|
||||||
def pascal_to_loudsnakes(text):
|
def pascal_to_loudsnakes(text):
|
||||||
'''
|
'''
|
||||||
|
|
Loading…
Reference in a new issue