Fix SyntaxWarnings on Python 3.8

This commit is contained in:
Valentin Lorentz 2019-01-06 18:06:44 +01:00
parent f7d00425c2
commit 7adc958dd6
2 changed files with 4 additions and 4 deletions

View File

@ -89,7 +89,7 @@ def rsplit(s, sep=None, maxsplit=-1):
return s.rsplit(sep, maxsplit)
def normalizeWhitespace(s, removeNewline=True):
"""Normalizes the whitespace in a string; \s+ becomes one space."""
r"""Normalizes the whitespace in a string; \s+ becomes one space."""
if not s:
return str(s) # not the same reference
starts_with_space = (s[0] in ' \n\t\r')
@ -525,7 +525,7 @@ def timestamp(t):
def url(url):
return url
_formatRe = re.compile('%((?:\d+)?\.\d+f|[bfhiLnpqrsStTuv%])')
_formatRe = re.compile(r'%((?:\d+)?\.\d+f|[bfhiLnpqrsStTuv%])')
def format(s, *args, **kwargs):
"""w00t.

View File

@ -308,7 +308,7 @@ class StrTest(SupyTestCase):
self.assertEqual(f('fooba\\rba\\z'), 'foorz')
f = PRTR('s/cat/dog/i')
self.assertEqual(f('CATFISH'), 'dogFISH')
f = PRTR('s/foo/foo\/bar/')
f = PRTR(r's/foo/foo\/bar/')
self.assertEqual(f('foo'), 'foo/bar')
f = PRTR('s/^/foo/')
self.assertEqual(f('bar'), 'foobar')
@ -326,7 +326,7 @@ class StrTest(SupyTestCase):
self.assertEqual(f('foobarbaz'), 'barbarbaz')
def testPerlReToReplacerBug850931(self):
f = utils.str.perlReToReplacer('s/\b(\w+)\b/\1./g')
f = utils.str.perlReToReplacer(r's/\b(\w+)\b/\1./g')
self.assertEqual(f('foo bar baz'), 'foo. bar. baz.')
def testCommaAndify(self):