tohojo / flent

The FLExible Network Tester.
https://flent.org
Other
428 stars 79 forks source link

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

Closed vincele closed 4 weeks ago

vincele commented 1 month ago

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 commented 1 month ago

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 commented 1 month ago

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 commented 1 month ago

Thanks for the fix! Yeah, we should use raw strings throughout. Please feel free to fix up all instances! :)

On 21 June 2024 23:39:40 CEST, Vincent Legoll @.***> wrote:

I went for the minimal fix, and not touched 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 ?

vincele commented 1 month ago

also tested OK

vincele commented 1 month ago

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