From: Ville Skyttä Date: Fri, 15 Sep 2017 21:07:04 +0000 (+0300) Subject: Python 3.6 invalid escape sequence deprecation fixes X-Git-Tag: v2.6.0~15^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=75b8f7899f0080e99a7793c4b97de07be06af518;p=thirdparty%2Fbabel.git Python 3.6 invalid escape sequence deprecation fixes https://docs.python.org/3/whatsnew/3.6.html#deprecated-python-behavior --- diff --git a/babel/core.py b/babel/core.py index df03b24a..7d38d43e 100644 --- a/babel/core.py +++ b/babel/core.py @@ -1118,7 +1118,7 @@ def parse_locale(identifier, sep='_'): def get_locale_identifier(tup, sep='_'): """The reverse of :func:`parse_locale`. It creates a locale identifier out of a ``(language, territory, script, variant)`` tuple. Items can be set to - ``None`` and trailing ``None``\s can also be left out of the tuple. + ``None`` and trailing ``None``\\s can also be left out of the tuple. >>> get_locale_identifier(('de', 'DE', None, '1999')) 'de_DE_1999' diff --git a/babel/dates.py b/babel/dates.py index d1fafe2a..3a075eb4 100644 --- a/babel/dates.py +++ b/babel/dates.py @@ -1155,7 +1155,7 @@ def parse_date(string, locale=LC_TIME): # FIXME: this currently only supports numbers, but should also support month # names, both in the requested locale, and english - numbers = re.findall('(\d+)', string) + numbers = re.findall(r'(\d+)', string) year = numbers[indexes['Y']] if len(year) == 2: year = 2000 + int(year) @@ -1198,7 +1198,7 @@ def parse_time(string, locale=LC_TIME): # and seconds should be optional, maybe minutes too # oh, and time-zones, of course - numbers = re.findall('(\d+)', string) + numbers = re.findall(r'(\d+)', string) hour = int(numbers[indexes['H']]) minute = int(numbers[indexes['M']]) second = int(numbers[indexes['S']]) diff --git a/babel/localtime/_unix.py b/babel/localtime/_unix.py index 8a8b4e96..561de0d6 100644 --- a/babel/localtime/_unix.py +++ b/babel/localtime/_unix.py @@ -100,9 +100,9 @@ def _get_localzone(_root='/'): # OpenSUSE has a TIMEZONE setting in /etc/sysconfig/clock and # Gentoo has a TIMEZONE setting in /etc/conf.d/clock # We look through these files for a timezone: - zone_re = re.compile('\s*ZONE\s*=\s*\"') - timezone_re = re.compile('\s*TIMEZONE\s*=\s*\"') - end_re = re.compile('\"') + zone_re = re.compile(r'\s*ZONE\s*=\s*"') + timezone_re = re.compile(r'\s*TIMEZONE\s*=\s*"') + end_re = re.compile(r'"') for filename in ('etc/sysconfig/clock', 'etc/conf.d/clock'): tzpath = os.path.join(_root, filename) diff --git a/babel/messages/checkers.py b/babel/messages/checkers.py index 24ecdcfe..c4669c53 100644 --- a/babel/messages/checkers.py +++ b/babel/messages/checkers.py @@ -61,7 +61,7 @@ def python_format(catalog, message): def _validate_format(format, alternative): """Test format string `alternative` against `format`. `format` can be the - msgid of a message and `alternative` one of the `msgstr`\s. The two + msgid of a message and `alternative` one of the `msgstr`\\s. The two arguments are not interchangeable as `alternative` may contain less placeholders if `format` uses named placeholders. diff --git a/babel/messages/frontend.py b/babel/messages/frontend.py index fb171e36..388c14b7 100644 --- a/babel/messages/frontend.py +++ b/babel/messages/frontend.py @@ -391,7 +391,7 @@ class extract_messages(Command): if self.input_paths: if isinstance(self.input_paths, string_types): - self.input_paths = re.split(',\s*', self.input_paths) + self.input_paths = re.split(r',\s*', self.input_paths) elif self.distribution is not None: self.input_paths = dict.fromkeys([ k.split('.', 1)[0] diff --git a/scripts/make-release.py b/scripts/make-release.py index dc9bb31e..245608a7 100755 --- a/scripts/make-release.py +++ b/scripts/make-release.py @@ -23,7 +23,7 @@ def parse_changelog(): with open('CHANGES') as f: lineiter = iter(f) for line in lineiter: - match = re.search('^Version\s+(.*)', line.strip()) + match = re.search(r'^Version\s+(.*)', line.strip()) if match is None: continue version = match.group(1).strip()