mirror of
https://github.com/davidhalter/parso.git
synced 2025-12-06 21:04:29 +08:00
Use escapes for some regex expressions.
This commit is contained in:
@@ -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".')
|
||||||
|
|||||||
@@ -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)])
|
||||||
|
|||||||
Reference in New Issue
Block a user