]> git.ipfire.org Git - thirdparty/babel.git/commitdiff
Python 3.6 invalid escape sequence deprecation fixes
authorVille Skyttä <ville.skytta@iki.fi>
Fri, 15 Sep 2017 21:07:04 +0000 (00:07 +0300)
committerVille Skyttä <ville.skytta@upcloud.com>
Sun, 17 Dec 2017 15:37:19 +0000 (17:37 +0200)
https://docs.python.org/3/whatsnew/3.6.html#deprecated-python-behavior

babel/core.py
babel/dates.py
babel/localtime/_unix.py
babel/messages/checkers.py
babel/messages/frontend.py
scripts/make-release.py

index df03b24adac75ff728e3f5b984b3fac8c5d3b043..7d38d43ec765108f60c3ccba2d691af4912704a1 100644 (file)
@@ -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'
index d1fafe2a70b9f7cffeaf1f19199ae82623f3fa16..3a075eb4770242bc7ee93ba094f5ebf0662af4f5 100644 (file)
@@ -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']])
index 8a8b4e9677c947bf3bdfa8f09ba222b8954a7817..561de0d6a30574f03f1fda317788e748b44626a9 100644 (file)
@@ -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)
index 24ecdcfedbdc0b7b1a5ad6911b8b65637d72162d..c4669c53b9b09e0420acd61ade0846b73cdc6509 100644 (file)
@@ -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.
 
index fb171e36a0fafa596cd7f13a6b82577ebd8eca11..388c14b7a9a8b84fe8b7d46fff6650c4b66afb11 100644 (file)
@@ -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]
index dc9bb31e6f8f3bca5a602d5acafa1b30064c7acc..245608a7327f218f26b7e49dac26d23a2f4888ce 100755 (executable)
@@ -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()