[FIX] *: remove invalid escape sequences

This commit is contained in:
Xavier-Do 2024-04-30 16:05:21 +02:00
parent e7d1cc9c57
commit 2a18cd7f3d
8 changed files with 9 additions and 9 deletions

View File

@ -58,7 +58,7 @@ class Project(models.Model):
return super()._find_commands(comment)
return re.findall(
'^\s*[@|#]?{}:? (.*)$'.format(self.fp_github_name),
r'^\s*[@|#]?{}:? (.*)$'.format(self.fp_github_name),
comment, re.MULTILINE | re.IGNORECASE
) + super()._find_commands(comment)
@ -358,7 +358,7 @@ class PullRequests(models.Model):
tokens = [
token
for line in re.findall('^\s*[@|#]?{}:? (.*)$'.format(self.repository.project_id.fp_github_name), comment['body'] or '', re.MULTILINE | re.IGNORECASE)
for line in re.findall(r'^\s*[@|#]?{}:? (.*)$'.format(self.repository.project_id.fp_github_name), comment['body'] or '', re.MULTILINE | re.IGNORECASE)
for token in line.split()
]
if not tokens:

View File

@ -403,7 +403,7 @@ conflict in this pull request, data may have been lost.
stdout:
```.*?
CONFLICT \(add/add\): Merge conflict in h.*?
CONFLICT \\(add/add\\): Merge conflict in h.*?
```
stderr:

View File

@ -1244,4 +1244,4 @@ class BuildResult(models.Model):
commit._github_status(build, trigger.ci_context, state, target_url, desc)
def _parse_config(self):
return set(findall(self._server("tools/config.py"), '--[\w-]+', ))
return set(findall(self._server("tools/config.py"), r'--[\w-]+', ))

View File

@ -52,7 +52,7 @@ class TestBuildError(RunbotCase):
def test_create_write_clean(self):
self.ErrorRegex.create({
'regex': '\d+',
'regex': r'\d+',
're_type': 'cleaning',
})

View File

@ -414,7 +414,7 @@ class TestIdentityFile(RunbotCase):
def check_output_helper(self):
"""Helper that returns a mock for repo._git()"""
def mock_check_output(cmd, *args, **kwargs):
expected_option = '-c core.sshCommand=ssh -i \/.+\/\.ssh\/fake_identity'
expected_option = r'-c core.sshCommand=ssh -i \/.+\/\.ssh\/fake_identity'
git_cmd = ' '.join(cmd)
self.assertTrue(re.search(expected_option, git_cmd), '%s did not match %s' % (git_cmd, expected_option))
return Mock()

View File

@ -30,7 +30,7 @@ class Step(models.Model):
mo = re.search('[^ <@]+@[^ @>]+', email or '')
if mo:
email = mo.group(0).lower()
if not re.match('.*@(odoo|openerp|tinyerp)\.com$', email):
if not re.match(r'.*@(odoo|openerp|tinyerp)\.com$', email):
try:
cla = ''.join(io.open(f, encoding='utf-8').read() for f in cla_glob)
if cla.lower().find(email) == -1:

View File

@ -74,7 +74,7 @@ class Project(models.Model):
def _find_commands(self, comment):
return re.findall(
'^\s*[@|#]?{}:? (.*)$'.format(self.github_prefix),
r'^\s*[@|#]?{}:? (.*)$'.format(self.github_prefix),
comment, re.MULTILINE | re.IGNORECASE)
def _has_branch(self, name):

View File

@ -624,7 +624,7 @@ def test_ff_failure(env, repo, config, page):
_new, prev = doc.cssselect('li.staging')
assert 'bg-gray-lighter' in prev.classes, "ff failure is ~ cancelling"
assert prev.get('title') == re_matches('fast forward failed \(update is not a fast forward\)')
assert prev.get('title') == re_matches(r'fast forward failed \(update is not a fast forward\)')
assert env['runbot_merge.pull_requests'].search([
('repository.name', '=', repo.name),