-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
SyntaxWarning on regexp on first run of black #4188
Comments
Thanks for the issue. First, some background on these warnings... The issue has little to do with See https://docs.python.org/3/reference/lexical_analysis.html#escape-sequences , in particular:
If you run your code with
Anyway, with that said, your code is legal today (if deprecated) and your use of deprecated invalid escape sequences isn't really part of Black's business, so Black should probably swallow these warnings. |
Thanks for your valuable response. I had never noticed that the uses I did of the backslash were invalid escape sequences for Python (contrary to the same uses in some other languages). I wrote them long time ago with Python 2, and it worked (though invalid, but the syntax error was not raised). I agree these warnings should not pop up when using Black. (Seems like it's time for me to also integrate Pyflakes and Pylint to improve the quality of my scripts.) |
When running
black
on the following code:I get the following warnings (written twice):
When re-running
black
on the same file, the warnings are not shown again. I have to modify the lines (adding a space for instance) to see the warnings again.Are these warnings normal? (The syntax is normally correct according to the documentation of the
re
module.)If they are normal, should they really appear twice in the output? And why don't they appear again when running a second time
black
?The text was updated successfully, but these errors were encountered: