diff options
author | Ville Skyttä <ville.skytta@iki.fi> | 2017-03-23 15:19:03 +0000 |
---|---|---|
committer | Thomas Kluyver <thomas@kluyver.me.uk> | 2017-03-23 15:19:03 +0000 |
commit | 24ba6401cb7fe6fbc0d4998692efc8d96918ae16 (patch) | |
tree | 084ab04db8190f671e55404f92f9b0909f9b0a53 | |
parent | bd999c1c3fe7ee5f30ede2cf704cf03e400347b4 (diff) |
Fix unnecessary escape sequences, deprecated in Python 3.6
From https://bugs.freedesktop.org/show_bug.cgi?id=100348
-rw-r--r-- | test/test-desktop.py | 2 | ||||
-rw-r--r-- | xdg/DesktopEntry.py | 2 | ||||
-rw-r--r-- | xdg/IconTheme.py | 4 | ||||
-rw-r--r-- | xdg/Locale.py | 2 |
4 files changed, 5 insertions, 5 deletions
diff --git a/test/test-desktop.py b/test/test-desktop.py index 440253e..e73ea5a 100644 --- a/test/test-desktop.py +++ b/test/test-desktop.py @@ -37,7 +37,7 @@ class DesktopEntryTest(unittest.TestCase): contents = f.read() assert "[Hallo]" in contents, contents - assert re.search("key\s*=\s*value", contents), contents + assert re.search(r"key\s*=\s*value", contents), contents # This is missing the Name key, and has an unknown Hallo group, so it # shouldn't validate. diff --git a/xdg/DesktopEntry.py b/xdg/DesktopEntry.py index ec1a0a0..84e6dd9 100644 --- a/xdg/DesktopEntry.py +++ b/xdg/DesktopEntry.py @@ -201,7 +201,7 @@ class DesktopEntry(IniFile): def checkGroup(self, group): # check if group header is valid if not (group == self.defaultGroup \ - or re.match("^Desktop Action [a-zA-Z0-9\-]+$", group) \ + or re.match("^Desktop Action [a-zA-Z0-9-]+$", group) \ or (re.match("^X-", group) and is_ascii(group))): self.errors.append("Invalid Group name: %s" % group) else: diff --git a/xdg/IconTheme.py b/xdg/IconTheme.py index adac99e..d795484 100644 --- a/xdg/IconTheme.py +++ b/xdg/IconTheme.py @@ -125,7 +125,7 @@ class IconTheme(IniFile): self.name = self.content[group]["Size"] except KeyError: self.errors.append("Key 'Size' in Group '%s' is missing" % group) - elif not (re.match("^\[X-", group) and is_ascii(group)): + elif not (re.match(r"^\[X-", group) and is_ascii(group)): self.errors.append("Invalid Group name: %s" % group) def checkKey(self, key, value, group): @@ -211,7 +211,7 @@ class IconData(IniFile): def checkGroup(self, group): # check if group header is valid if not (group == self.defaultGroup \ - or (re.match("^\[X-", group) and is_ascii(group))): + or (re.match(r"^\[X-", group) and is_ascii(group))): self.errors.append("Invalid Group name: %s" % group.encode("ascii", "replace")) def checkKey(self, key, value, group): diff --git a/xdg/Locale.py b/xdg/Locale.py index d30d91a..d0a70d2 100644 --- a/xdg/Locale.py +++ b/xdg/Locale.py @@ -9,7 +9,7 @@ http://cvs.sourceforge.net/viewcvs.py/rox/ROX-Lib2/python/rox/i18n.py?rev=1.3&vi import os from locale import normalize -regex = "(\[([a-zA-Z]+)(_[a-zA-Z]+)?(\.[a-zA-Z\-0-9]+)?(@[a-zA-Z]+)?\])?" +regex = r"(\[([a-zA-Z]+)(_[a-zA-Z]+)?(\.[a-zA-Z0-9-]+)?(@[a-zA-Z]+)?\])?" def _expand_lang(locale): locale = normalize(locale) |