Skip to content

Commit

Permalink
Fix SyntaxWarning for '\w' '\d' in regexes
Browse files Browse the repository at this point in the history
Use raw strings literals for the affected regexes

(venv-flent) $ flent -V
/path/to/flent/flent/metadata.py:247: SyntaxWarning: invalid escape sequence '\d'
  m = re.search("(qlen|txqueuelen) (\d+)", output)
/path/to/flent/flent/metadata.py:259: SyntaxWarning: invalid escape sequence '\w'
  m = re.search("Duplex: (\w+)", output)
Starting Flent 2.1.1+git.6c8dce50 using Python 3.12.4.
Flent v2.1.1+git.6c8dce50.
Running on Python 3.12.4 (main, Jun  9 2024, 22:05:49) [GCC 13.2.0].
No matplotlib found. Plots won't be available.
No usable Qt version found. GUI won't work.
ERROR: Missing test name.

Signed-off-by: Vincent Legoll <[email protected]>
  • Loading branch information
vincele committed Jun 21, 2024
1 parent 6c8dce5 commit b8007ad
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions flent/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ 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)
Expand All @@ -256,7 +256,7 @@ def get_link_params(iface):
m = re.search("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

0 comments on commit b8007ad

Please sign in to comment.