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

Conversation

vincele
Copy link
Contributor

@vincele vincele commented Jun 21, 2024

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.

@vincele
Copy link
Contributor Author

vincele commented Jun 21, 2024

Tested with a simple 10s run:
(venv-flent) [user@host flent]$ flent rrul -p all_scaled -l 10 -H netperf-eu.bufferbloat.net -t test -o flent.png -L logfile

logfile contains:
2024-06-21 23:19:04,618 [flent.metadata] DEBUG: Executing 'ip link show dev enp41s0' on localhost

@vincele
Copy link
Contributor Author

vincele commented Jun 21, 2024

I went for the minimal fix, and did not touch the other regexes.

But a quick grep showed that the non-raw strings regexes are the minority, so maybe you'll want the full conversion...

I can do that, in addition to the simple fix or a single commit for the lot.

What do you think ?

@tohojo
Copy link
Owner

tohojo commented Jun 22, 2024 via email

Use raw string 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]>
@vincele
Copy link
Contributor Author

vincele commented Jun 22, 2024

also tested OK

@vincele
Copy link
Contributor Author

vincele commented Jun 23, 2024

I gave a quick glance at each test suite failure, for this PR,
and it looks like the test suite failures are related to numpy
and/or matplotlib.

Probably not related to the PR modifications

@tohojo tohojo merged commit 349af14 into tohojo:master Jun 24, 2024
37 of 58 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants