Use escapes for some regex expressions.

This commit is contained in:
Dave Halter
2017-05-26 14:19:06 -04:00
parent adc3ec268a
commit 7c1f3b3a65
2 changed files with 2 additions and 2 deletions

View File

@@ -134,7 +134,7 @@ class Grammar(object):
def _parse_version(version): def _parse_version(version):
match = re.match('(\d+)(?:\.(\d)(?:\.\d+)?)?$', version) match = re.match(r'(\d+)(?:\.(\d)(?:\.\d+)?)?$', version)
if match is None: if match is None:
raise ValueError('The given version is not in the right format. ' raise ValueError('The given version is not in the right format. '
'Use something like "3.2" or "3".') 'Use something like "3.2" or "3".')

View File

@@ -83,5 +83,5 @@ def version_info():
""" """
Version = namedtuple('Version', 'major, minor, micro') Version = namedtuple('Version', 'major, minor, micro')
from parso import __version__ from parso import __version__
tupl = re.findall('[a-z]+|\d+', __version__) tupl = re.findall(r'[a-z]+|\d+', __version__)
return Version(*[x if i == 3 else int(x) for i, x in enumerate(tupl)]) return Version(*[x if i == 3 else int(x) for i, x in enumerate(tupl)])