Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Deprecation warning due to invalid escape sequences #7894

Closed
tirkarthi opened this issue Jul 18, 2020 · 6 comments · Fixed by #7895
Closed

Deprecation warning due to invalid escape sequences #7894

tirkarthi opened this issue Jul 18, 2020 · 6 comments · Fixed by #7895
Labels
z-p3 (Deprecated Label)

Comments

@tirkarthi
Copy link
Contributor

Description

Deprecation warnings are raised due to invalid escape sequences. This can be fixed by using raw strings or escaping the literals. pyupgrade also helps in automatic conversion : https://github.com/asottile/pyupgrade/

Steps to reproduce

./contrib/experiments/test_messaging.py:78: DeprecationWarning: invalid escape sequence \S
  m = re.match("^join (\S+)$", line)
./contrib/experiments/test_messaging.py:87: DeprecationWarning: invalid escape sequence \S
  m = re.match("^invite (\S+) (\S+)$", line)
./contrib/experiments/test_messaging.py:96: DeprecationWarning: invalid escape sequence \S
  m = re.match("^send (\S+) (.*)$", line)
./contrib/experiments/test_messaging.py:105: DeprecationWarning: invalid escape sequence \S
  m = re.match("^backfill (\S+)$", line)
@clokep
Copy link
Contributor

clokep commented Jul 20, 2020

Is there a particular way you've gone about finding these deprecation warnings? (Running the tests with specific flags or...?)

@tirkarthi
Copy link
Contributor Author

Sorry, I forgot to include the command.

find . -iname '*.py' | grep -Ev 'vendor|example|doc|tools|sphinx' | xargs -P4 -I{} python3.8 -Wall -m py_compile {}

@tirkarthi
Copy link
Contributor Author

Running the above command in project root should print the warnings.

@anoadragon453
Copy link
Member

In my case (with python environments and tox directories hanging about), I needed to use the following slightly modified command:

find . -path ./env -prune -o -path ./.tox -prune -o -path ./build -prune -o -iname '*.py' | grep -Ev 'vendor|example|doc|tools|sphinx' | xargs -P4 -I{} python3.8 -Wall -m py_compile {}

but regardless, this looks useful to run on the regular, and thank you for the PR cleaning it up.

I'm interested to know whether people think this should be part of CI?

@anoadragon453 anoadragon453 added the z-p3 (Deprecated Label) label Jul 20, 2020
@clokep
Copy link
Contributor

clokep commented Jul 20, 2020

I'm interested to know whether people think this should be part of CI?

That was my thought. :) Might be worth filing an issue about.

@anoadragon453
Copy link
Member

@clokep #7909

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
z-p3 (Deprecated Label)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants