-
Notifications
You must be signed in to change notification settings - Fork 208
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: Invalid escape sequences #1352
Conversation
head += 'TMP=\$(mktemp -d); ' #create temp dir used for delete files with rsync | ||
head += 'test -z \\\"\$TMP\\\" && exit 1; ' #make sure $TMP dir was created | ||
head += 'test -n \\\"\$(ls \$TMP)\\\" && exit 1; ' #make sure $TMP is empty | ||
# create temp dir used for delete files with rsync | ||
head += 'TMP=\\$(mktemp -d); ' | ||
# make sure $TMP dir was created | ||
head += 'test -z \\\"\\$TMP\\\" && exit 1; ' | ||
# make sure $TMP is empty | ||
head += 'test -n \\\"\\$(ls \\$TMP)\\\" && exit 1; ' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry the diff here is hard to see.
In all three lines the \$
was modified to \\$
.
m = re.match(b'^.*?\s+\d+\s+\d+\s+(\d+)\s+\d+%', line, re.M) | ||
m = re.match(r'^.*?\s+\d+\s+\d+\s+(\d+)\s+\d+%', line.decode(), re.M) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The output from shell was catched as binary instead of a string. No need for that.
Converted that to a real string (via .decode()
) and run a raw regex string (via r''
) on it.
ATTENTION: That content is auto-generated by a stupid algorithm. Some of that information's and links are not valid, wrong and missleading. It was just a test.
|
Sorry I couldn't resists. Just read that heise-Article about a GPT-3 based algorithm generate summary text from code diffs for PRs. I see no value in such a tool even if it would work 100% perfect. I just played a bit arround. |
@buhtzz If you want you could also fix a few more "invalid escape sequence" warning candidates in:
Edit: These code lines are not covered by unit test so you don't see the warnings |
Good idea. In a short test I can find much more via |
That's fine, no urgent need so far. |
This fix
DeprecationWarnings
about invalid escape sequences. Most of that warnings are caught when runningpytest
. That warnings will become serious errors in future Python versions.This where the warnings. Sorry for providing a screenshot instead of plain text but I still have problems copy & past from a Windows terminal window running ssh client and tmux.
Of course, I checked all problems and what that strings really need to do.
Most of the warnings are about
\$
which I modified to\\$
. It is like escaping and escape. Sounds wired but it is intended to be that way. Because that string is handed over (viasubprocess.Popen()
) to a shell command (ssh) which need to receive a string containing an escape.