-
Notifications
You must be signed in to change notification settings - Fork 130
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
[third-party] Mark inst2vec regexes as regex literals. #594
[third-party] Mark inst2vec regexes as regex literals. #594
Conversation
It is now deprecated to use regex escape characters in string literals..
Codecov Report
@@ Coverage Diff @@
## development #594 +/- ##
===============================================
- Coverage 88.17% 79.97% -8.20%
===============================================
Files 114 114
Lines 6708 6708
===============================================
- Hits 5915 5365 -550
- Misses 793 1343 +550
Continue to review full report at Codecov.
|
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.
LGTM
array_of_array_type = "\[\d+ x " + "\[\d+ x " + rgx.first_class_type + "\]" + "\]" | ||
vector_type = r"<\d+ x " + rgx.first_class_type + r">" | ||
array_type = r"\[\d+ x " + rgx.first_class_type + r"\]" | ||
array_of_array_type = r"\[\d+ x " + r"\[\d+ x " + rgx.first_class_type + r"\]" + r"\]" |
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.
Consider rf-strings?
array_of_array_type = rf"\[\d+ x \[\d+ x {rgx.first_class_type}\]\]"
else: | ||
s += possibilities[0] | ||
for i in range(len(possibilities) - 1): | ||
if len(to_add) > 0: | ||
s += "|" + possibilities[i + 1] + to_add + " " | ||
s += r"|" + possibilities[i + 1] + to_add + r" " |
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.
Not that it's wrong, but... why? I can see it when you have backslashes, but there are lots of changes here with no backslashes. Is it sensible to use additional abstractions which aren't necessary?
IMO, only use r
-strings where necessary. Use f
-strings or rf
-strings a lot more.
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.
I agree. Its an automatic refactoring of third party code. Rewriting the regexes to rf
-strings would be nice, but I don't know how to do it automatically
It is now deprecated to use regex escape characters in string literals.
This adds the "r" string prefix to the regex literals in
compiler_gym/third_party/inst2vec/inst2vec_preprocess.py
.