diff --git a/Client/src/bkr/client/__init__.py b/Client/src/bkr/client/__init__.py
index 29efc5da6..b7ca89859 100644
--- a/Client/src/bkr/client/__init__.py
+++ b/Client/src/bkr/client/__init__.py
@@ -61,7 +61,7 @@ def host_filter_presets():
for f in config_files:
with open(f) as fobj:
for line in fobj:
- matched = re.match('^(\w+)\s+(\S+.*)$', line)
+ matched = re.match(r'^(\w+)\s+(\S+.*)$', line)
if matched:
preset, xml = matched.groups()
_host_filter_presets[preset] = xml
diff --git a/Client/src/bkr/client/commands/cmd_workflow_xslt.py b/Client/src/bkr/client/commands/cmd_workflow_xslt.py
index 9ea230252..8d599b85b 100644
--- a/Client/src/bkr/client/commands/cmd_workflow_xslt.py
+++ b/Client/src/bkr/client/commands/cmd_workflow_xslt.py
@@ -35,7 +35,7 @@ def __init__(self):
self.arguments = {}
self.current = None
self.current_node = None
- self.re_tag = re.compile('(.*)(\[@(.*)=(.*)\])')
+ self.re_tag = re.compile(r'(.*)(\[@(.*)=(.*)\])')
def add_argument(self, name, argtype, tagname, tagvaltype, tagvalname,
tagnamelmnt, value, optional):
diff --git a/Client/src/bkr/client/tests/test_wizard.py b/Client/src/bkr/client/tests/test_wizard.py
index 3c541fe8b..ffdac2693 100644
--- a/Client/src/bkr/client/tests/test_wizard.py
+++ b/Client/src/bkr/client/tests/test_wizard.py
@@ -125,7 +125,7 @@ def test_shell_metachars_escaped_in_makefile(self):
desc = wizard.Desc(options, suggest="Test for BZ#1234567 "
"(I ran `rm -rf ~` and everything's gone suddenly)")
self.assertEqual(
- """\n \t@echo "Description: Test for BZ#1234567 (I ran \`rm -rf ~\` and everything's gone suddenly)" >> $(METADATA)""",
+ """\n \t@echo "Description: Test for BZ#1234567 (I ran \\`rm -rf ~\\` and everything's gone suddenly)" >> $(METADATA)""",
desc.formatMakefileLine())
diff --git a/Client/src/bkr/client/wizard.py b/Client/src/bkr/client/wizard.py
index 01ad8c987..a91f61746 100755
--- a/Client/src/bkr/client/wizard.py
+++ b/Client/src/bkr/client/wizard.py
@@ -364,24 +364,24 @@
WizardVersion = "2.3.2"
# Regular expressions
-RegExpPackage = re.compile("^(?![._+-])[.a-zA-Z0-9_+-]+(?", options.opt.owner)
+ m = re.search(r"(.*)\s+<(.*)>", options.opt.owner)
if m:
options.opt.author = m.group(1)
options.opt.email = m.group(2)
@@ -1237,9 +1237,9 @@ def defaultify(self):
def normalize(self):
""" Remove trailing and double spaces """
if not self.data: return
- self.data = re.sub("^\s*", "", self.data)
- self.data = re.sub("\s*$", "", self.data)
- self.data = re.sub("\s+", " ", self.data)
+ self.data = re.sub(r"^\s*", "", self.data)
+ self.data = re.sub(r"\s*$", "", self.data)
+ self.data = re.sub(r"\s+", " ", self.data)
def read(self):
"""
@@ -1259,7 +1259,7 @@ def read(self):
if answer != "":
# append the data if the answer starts with a "+",
# but ignore if only "+" is present
- m = re.search("^\+\S+(.*)", answer)
+ m = re.search(r"^\+\S+(.*)", answer)
if m and isinstance(self.data, list):
self.data.append(m.group(1))
else:
@@ -1289,7 +1289,7 @@ def singleName(self):
def matchName(self, text):
""" Return true if the text matches inquisitor's name """
# remove any special characters from the search string
- text = re.sub("[^\w\s]", "", text)
+ text = re.sub(r"[^\w\s]", "", text)
return re.search(text, self.name, re.I)
def describe(self):
@@ -1649,7 +1649,7 @@ def init(self):
self.default(self.options.time())
def valid(self):
- m = re.match("^(\d{1,2})[mhd]$", self.data)
+ m = re.match(r"^(\d{1,2})[mhd]$", self.data)
return m is not None and int(m.group(1)) > 0
@@ -1664,7 +1664,7 @@ def init(self):
self.default(self.options.version())
def valid(self):
- return re.match("^\d+\.\d+$", self.data)
+ return re.match(r"^\d+\.\d+$", self.data)
class Priority(SingleChoice):
@@ -1965,7 +1965,7 @@ def fetchBugDetails(self):
def getSummary(self):
""" Return short summary fetched from bugzilla """
if self.bug:
- return re.sub("CVE-\d{4}-\d{4}\s*", "", removeEmbargo(self.bug.summary))
+ return re.sub(r"CVE-\d{4}-\d{4}\s*", "", removeEmbargo(self.bug.summary))
def getComponent(self):
""" Return bug component fetched from bugzilla """
@@ -2256,7 +2256,7 @@ def init(self):
rlJournalStart
rlPhaseStartSetup
rlAssertRpm $PACKAGE
- rlRun "TmpDir=\$(mktemp -d)" 0 "Creating tmp directory"
+ rlRun "TmpDir=\\$(mktemp -d)" 0 "Creating tmp directory"
rlRun "pushd $TmpDir"
rlPhaseEnd
@@ -2283,7 +2283,7 @@ def init(self):
rlJournalStart
rlPhaseStartSetup
rlAssertRpm $PACKAGE || rlDie "$PACKAGE not installed"
- rlRun "TmpDir=\$(mktemp -d)" 0 "Creating tmp directory"
+ rlRun "TmpDir=\\$(mktemp -d)" 0 "Creating tmp directory"
rlRun "pushd $TmpDir"
rlPhaseEnd
@@ -2373,7 +2373,7 @@ def init(self):
rlAssertRpm $PACKAGE
rlLog "Server: $SERVERS"
rlLog "Client: $CLIENTS"
- rlRun "TmpDir=\$(mktemp -d)" 0 "Creating tmp directory"
+ rlRun "TmpDir=\\$(mktemp -d)" 0 "Creating tmp directory"
rlRun "pushd $TmpDir"
rlPhaseEnd
@@ -2409,7 +2409,7 @@ def init(self):
rlJournalStart
rlPhaseStartSetup
rlRun "rlImport /"
- rlRun "TmpDir=\$(mktemp -d)" 0 "Creating tmp directory"
+ rlRun "TmpDir=\\$(mktemp -d)" 0 "Creating tmp directory"
rlRun "pushd $TmpDir"
rlPhaseEnd
@@ -2456,7 +2456,7 @@ def init(self):
rlJournalStart
rlPhaseStartSetup
rlAssertRpm --all
- rlRun "TmpDir=\$(mktemp -d)" 0 "Creating tmp directory"
+ rlRun "TmpDir=\\$(mktemp -d)" 0 "Creating tmp directory"
rlRun "pushd $TmpDir"
rlPhaseEnd
@@ -2716,7 +2716,7 @@ def getRuntest(self, test = None):
# substitute variables, convert to plain text
skeleton = self.replaceVariables(skeleton, test)
# return dedented skeleton without trailing whitespace
- skeleton = re.sub("\n\s+$", "\n", skeleton)
+ skeleton = re.sub(r"\n\s+$", "\n", skeleton)
return dedentText(skeleton)
def getRhtsRequires(self):
diff --git a/IntegrationTests/src/bkr/inttest/client/test_update_inventory.py b/IntegrationTests/src/bkr/inttest/client/test_update_inventory.py
index 6c56deb55..2019bf736 100644
--- a/IntegrationTests/src/bkr/inttest/client/test_update_inventory.py
+++ b/IntegrationTests/src/bkr/inttest/client/test_update_inventory.py
@@ -69,7 +69,7 @@ def test_update_inventory_wait(self):
proc = start_client(args)
out = proc.stdout.readline().rstrip()
self.assert_(out.startswith('Submitted:'), out)
- m = re.search('J:(\d+)', out)
+ m = re.search(r'J:(\d+)', out)
job_id = m.group(1)
out = proc.stdout.readline().rstrip()
self.assert_('Watching tasks (this may be safely interrupted)...' == out)
diff --git a/IntegrationTests/src/bkr/inttest/client/test_watchdogs_show.py b/IntegrationTests/src/bkr/inttest/client/test_watchdogs_show.py
index f8fee0997..70165c3d7 100644
--- a/IntegrationTests/src/bkr/inttest/client/test_watchdogs_show.py
+++ b/IntegrationTests/src/bkr/inttest/client/test_watchdogs_show.py
@@ -24,7 +24,7 @@ def test_watchdog_show_running_task(self):
datetime.timedelta(seconds=99)
out = run_client(['bkr', 'watchdog-show', str(t1.id)])
# Let's just check it is somewhere between 10-99
- self.assertTrue(re.match('%s: \d\d\\n' % t1.id, out))
+ self.assertTrue(re.match(r'%s: \d\d\n' % t1.id, out))
def test_watchdog_show_non_running_task(self):
with session.begin():
diff --git a/IntegrationTests/src/bkr/inttest/client/test_workflow_simple.py b/IntegrationTests/src/bkr/inttest/client/test_workflow_simple.py
index 1ceacb138..0e98bad2f 100644
--- a/IntegrationTests/src/bkr/inttest/client/test_workflow_simple.py
+++ b/IntegrationTests/src/bkr/inttest/client/test_workflow_simple.py
@@ -65,7 +65,7 @@ def test_job_group(self):
'--job-group', group.group_name,
'--task', self.task.name], config=config1)
self.assertTrue(out.startswith('Submitted:'), out)
- m = re.search('J:(\d+)', out)
+ m = re.search(r'J:(\d+)', out)
job_id = m.group(1)
with session.begin():
job = Job.by_id(job_id)
@@ -98,7 +98,7 @@ def test_job_owner(self):
'--family', self.distro.osversion.osmajor.osmajor,
'--task', self.task.name], config=config)
self.assertTrue(out.startswith('Submitted:'), out)
- m = re.search('J:(\d+)', out)
+ m = re.search(r'J:(\d+)', out)
job_id = m.group(1)
with session.begin():
job = Job.by_id(job_id)
@@ -120,7 +120,7 @@ def test_submit_job_wait(self):
proc = start_client(args)
out = proc.stdout.readline().rstrip()
self.assert_(out.startswith('Submitted:'), out)
- m = re.search('J:(\d+)', out)
+ m = re.search(r'J:(\d+)', out)
job_id = m.group(1)
out = proc.stdout.readline().rstrip()
@@ -334,7 +334,7 @@ def test_servers_default_zero(self):
'--task', '/distribution/reservesys',
'--clients', '2'])
self.assertTrue(out.startswith('Submitted:'), out)
- m = re.search('J:(\d+)', out)
+ m = re.search(r'J:(\d+)', out)
job_id = m.group(1)
with session.begin():
job = Job.by_id(job_id)
@@ -349,7 +349,7 @@ def test_clients_default_zero(self):
'--task', '/distribution/reservesys',
'--servers', '2'])
self.assertTrue(out.startswith('Submitted:'), out)
- m = re.search('J:(\d+)', out)
+ m = re.search(r'J:(\d+)', out)
job_id = m.group(1)
with session.begin():
job = Job.by_id(job_id)
@@ -362,7 +362,7 @@ def submit_job_and_check_arches(self, workflow_options, expected_arches):
out = run_client(['bkr', 'workflow-simple', '--task', self.task.name]
+ workflow_options)
self.assertTrue(out.startswith('Submitted:'), out)
- m = re.search('J:(\d+)', out)
+ m = re.search(r'J:(\d+)', out)
job_id = m.group(1)
with session.begin():
job = Job.by_id(job_id)
@@ -435,7 +435,7 @@ def test_kickstart_template(self):
'--task', self.task.name,
'--kickstart', template_file.name])
self.assertTrue(out.startswith('Submitted:'), out)
- m = re.search('J:(\d+)', out)
+ m = re.search(r'J:(\d+)', out)
job_id = m.group(1)
with session.begin():
job = Job.by_id(job_id)
@@ -456,7 +456,7 @@ def test_kickstart_template_with_kernel_options(self):
'--task', self.task.name,
'--kickstart', template_file.name])
self.assertTrue(out.startswith('Submitted:'), out)
- m = re.search('J:(\d+)', out)
+ m = re.search(r'J:(\d+)', out)
job_id = m.group(1)
with session.begin():
job = Job.by_id(job_id)
@@ -484,7 +484,7 @@ def test_no_default_install_method(self):
out = run_client(['bkr', 'workflow-simple', '--distro', self.distro.name,
'--task', self.task.name])
self.assertTrue(out.startswith('Submitted:'), out)
- m = re.search('J:(\d+)', out)
+ m = re.search(r'J:(\d+)', out)
job_id = m.group(1)
with session.begin():
job = Job.by_id(job_id)
@@ -557,7 +557,7 @@ def _verify_check_install(self, distro):
'--distro', distro.name,
'--task', self.task.name])
self.assertIn('Submitted:', out)
- m = re.search('J:(\d+)', out)
+ m = re.search(r'J:(\d+)', out)
job_id = m.group(1)
with session.begin():
job = Job.by_id(job_id)