Permalink
Browse files

Don't use invalid escape sequences in regex, see davidhalter/jedi-vim…

  • Loading branch information...
davidhalter committed Jul 12, 2018
1 parent e6bc924 commit 7064ecf3fb1144e9bc83cd0968fc4b77102341d9
Showing with 5 additions and 5 deletions.
  1. +3 −3 parso/python/pep8.py
  2. +1 −1 parso/python/tree.py
  3. +1 −1 parso/utils.py
View
@@ -391,11 +391,11 @@ def _visit_part(self, part, spacing, leaf):
if value.lstrip('#'):
self.add_issue(part, 266, "Too many leading '#' for block comment.")
elif self._on_newline:
if not re.match('#:? ', value) and not value == '#' \
if not re.match(r'#:? ', value) and not value == '#' \
and not (value.startswith('#!') and part.start_pos == (1, 0)):
self.add_issue(part, 265, "Block comment should start with '# '")
else:
if not re.match('#:? [^ ]', value):
if not re.match(r'#:? [^ ]', value):
self.add_issue(part, 262, "Inline comment should start with '# '")
self._reset_newlines(spacing, leaf, is_comment=True)
@@ -677,7 +677,7 @@ def _analyse_non_prefix(self, leaf):
elif typ == 'string':
# Checking multiline strings
for i, line in enumerate(leaf.value.splitlines()[1:]):
indentation = re.match('[ \t]*', line).group(0)
indentation = re.match(r'[ \t]*', line).group(0)
start_pos = leaf.line + i, len(indentation)
# TODO check multiline indentation.
elif typ == 'endmarker':
View
@@ -252,7 +252,7 @@ class String(Literal):
@property
def string_prefix(self):
return re.match('\w*(?=[\'"])', self.value).group(0)
return re.match(r'\w*(?=[\'"])', self.value).group(0)
def _get_payload(self):
match = re.search(
View
@@ -45,7 +45,7 @@ def split_lines(string, keepends=False):
lst.append('')
return lst
else:
return re.split('\n|\r\n', string)
return re.split(r'\n|\r\n', string)
def python_bytes_to_unicode(source, encoding='utf-8', errors='strict'):

0 comments on commit 7064ecf

Please sign in to comment.