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'
# 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)
# 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']])
# 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)
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.
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]
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()