Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix SyntaxWarning for '\w' '\d' in regexes #307

Merged
merged 2 commits into from
Jun 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions flent/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ def get_ip_addrs(iface=None):
cmd += " %s" % iface
output = get_command_output(cmd)

iface_re = re.compile('^([0-9]+: )?([a-z0-9-]+):')
iface_re = re.compile(r'^([0-9]+: )?([a-z0-9-]+):')

if output is not None:
lines = output.splitlines()
Expand Down Expand Up @@ -244,19 +244,19 @@ def get_link_params(iface):
output = get_command_output("ifconfig %s" % iface)

if output is not None:
m = re.search("(qlen|txqueuelen) (\d+)", output)
m = re.search(r"(qlen|txqueuelen) (\d+)", output)
if m:
link_params['qlen'] = m.group(2)
m = re.search("ether ([0-9a-f:]{17})", output)
m = re.search(r"ether ([0-9a-f:]{17})", output)
if m:
link_params['ether'] = m.group(1)

output = get_command_output("ethtool %s" % iface)
if output is not None:
m = re.search("Speed: ([0-9]+Mb/s)", output)
m = re.search(r"Speed: ([0-9]+Mb/s)", output)
if m:
link_params['speed'] = m.group(1)
m = re.search("Duplex: (\w+)", output)
m = re.search(r"Duplex: (\w+)", output)
if m:
link_params['duplex'] = m.group(1)

Expand Down
2 changes: 1 addition & 1 deletion flent/runners.py
Original file line number Diff line number Diff line change
Expand Up @@ -1784,7 +1784,7 @@ def check(self):
irtt = util.which('irtt', fail=RunnerCheckError, remote_host=self.remote_host)

out, err = self.run_simple([irtt, 'help', 'client'])
if re.search('--[a-z]', out) is None:
if re.search(r'--[a-z]', out) is None:
raise RunnerCheckError("%s is too old to support gnu style args. "
"Please upgrade to irtt v0.9+." % irtt)

Expand Down
Loading