-
Notifications
You must be signed in to change notification settings - Fork 78
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
Conversation
affc608
to
b8007ad
Compare
Tested with a simple 10s run: logfile contains: |
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 ? |
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 ?
|
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]>
Signed-off-by: Vincent Legoll <[email protected]>
b8007ad
to
b013fee
Compare
also tested OK |
I gave a quick glance at each test suite failure, for this PR, Probably not related to the PR modifications |
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.