fix PEP8 W605 invalid escape sequence

Python 3.7 will get a lot stricter with escape sequences.  They must be
valid.

* https://lintlyci.github.io/Flake8Rules/rules/W605.html
* https://docs.python.org/3/whatsnew/3.6.html#deprecated-python-behavior
This commit is contained in:
Hans-Christoph Steiner 2018-05-29 13:51:47 +02:00
parent e6d5260c3c
commit ff90c0246e
11 changed files with 24 additions and 24 deletions

View file

@ -61,13 +61,13 @@ class BuildTest(unittest.TestCase):
os.path.join(testdir, 'source-files'))
teststring = 'FAKE_VERSION_FOR_TESTING'
fdroidserver.build.force_gradle_build_tools(testdir, teststring)
pattern = re.compile(bytes("buildToolsVersion[\s=]+'%s'\s+" % teststring, 'utf8'))
pattern = re.compile(r"buildToolsVersion[\s=]+'%s'\s+" % teststring)
for p in ('source-files/fdroid/fdroidclient/build.gradle',
'source-files/Zillode/syncthing-silk/build.gradle',
'source-files/open-keychain/open-keychain/build.gradle',
'source-files/osmandapp/osmand/build.gradle',
'source-files/open-keychain/open-keychain/OpenKeychain/build.gradle'):
with open(os.path.join(testdir, p), 'rb') as f:
with open(os.path.join(testdir, p), 'r') as f:
filedata = f.read()
self.assertIsNotNone(pattern.search(filedata))

View file

@ -204,7 +204,7 @@ class CommonTest(unittest.TestCase):
with open(os.path.join(fdroidclient_testdir, 'build.gradle'), 'r') as f:
filedata = f.read()
self.assertIsNotNone(re.search("\s+compileSdkVersion %s\s+" % testint, filedata))
self.assertIsNotNone(re.search(r"\s+compileSdkVersion %s\s+" % testint, filedata))
with open(os.path.join(fdroidclient_testdir, 'AndroidManifest.xml')) as f:
filedata = f.read()

View file

@ -53,9 +53,9 @@ class IndexTest(unittest.TestCase):
_, fingerprint = fdroidserver.index.get_public_key_from_jar(jar)
# comparing fingerprints should be sufficient
if f == 'testy.jar':
self.assertTrue(fingerprint ==
'818E469465F96B704E27BE2FEE4C63AB' +
'9F83DDF30E7A34C7371A4728D83B0BC1')
self.assertEqual(fingerprint,
'818E469465F96B704E27BE2FEE4C63AB'
+ '9F83DDF30E7A34C7371A4728D83B0BC1')
if f == 'guardianproject.jar':
self.assertTrue(fingerprint == GP_FINGERPRINT)