-
Notifications
You must be signed in to change notification settings - Fork 5.8k
[CodeStyle][W605] Add escape symbols to some strings #46752
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
Conversation
你的PR提交成功,感谢你对开源项目的贡献! |
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.
辛苦了,这个错误码需要修改的地方还是蛮多的,有一些小的细节可能需要调整下~
@@ -35,7 +35,7 @@ def get_all_paddle_file(rootPath): | |||
def get_all_uts(rootPath): | |||
all_uts_paddle = '%s/build/all_uts_paddle' % rootPath | |||
os.system( | |||
'cd %s/build && ctest -N -V | grep -Ei "Test[ \t]+#" | grep -oEi "\w+$" > %s' | |||
r'cd %s/build && ctest -N -V | grep -Ei "Test[ \t]+#" | grep -oEi "\w+$" > %s' |
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.
这里在 Python runtime 是认为不等价的,但在 grep 看来是等价的,更多讨论见:cattidea/paddle-flake8-project#66 (comment)
(不用回复,这里只是链接下之前的讨论)
@@ -211,7 +211,7 @@ def convert_op_proto_into_mlir(op_descs): | |||
dst_dialect_file = "../../paddle/infrt/dialect/pd/ir/pd_ops.td" | |||
|
|||
# 1. Head files | |||
comment_ = "/*===- TableGen'source file -----------------------------------------------===*\\\n\ | |||
comment_ = r"/*===- TableGen'source file -----------------------------------------------===*\\\n\ |
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.
这里因为 '\n'
的存在也不是等价的,最后生成的代码文本里就会出现一堆 '\n'
😂,这里建议将左下角的 '\*==='
手动转义改为 '\\*==='
吧,就不加 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.
已修改~
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.
好哒~等过完 CI 我再看下~
Co-authored-by: Nyakku Shigure <sigure.qaq@gmail.com>
@@ -26,7 +26,7 @@ def attention(query, | |||
key_padding_mask=None, | |||
attn_mask=None, | |||
name=None): | |||
""" | |||
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.
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.
了解
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.
这个要不先回撤掉这一个修改,在另外一个 PR 里单独修复这一个?这样能确保其余部分是能够正常过 CI 的,另外一个 PR 里再单独考虑怎么做
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.
好的,我先改改
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.
@SigureMo 奇怪,这里我改回去了还是过不了CI,感觉像是只要出现了doc变化可能就会出现。Static-Check似乎需要approval
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.
只要出现了doc变化可能就会出现。Static-Check似乎需要approval
对的,等其他流水线过后,Static-Check会进行approve豁免
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.
想问下为什么有的注释要加r
,有的注释不需要呢?可以不加么?
是这样的,对于 Python 「字符串」,如果其中包含转义序列如 同样,很多 docstring 里因为需要书写公式的缘故,使用了 关于一些不加还是会正确显示的文档,其实这是 Python 对这些错误的转义序列自动进行了转义,如 一些前置讨论可见 cattidea/paddle-flake8-project#66 |
@caolonghao PR-CI-Windows 挂掉了,应该手动 re-run 下就可以过了~ |
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.
LGM
需要解决下冲突 |
3eb02a3
@@ -37,7 +37,7 @@ def attention(query, | |||
|
|||
.. math:: | |||
|
|||
result = softmax(\frac{ Q * K^T }{\sqrt{d}}) * V | |||
result = softmax(\frac{ Q * K^T }{\\sqrt{d}}) * V |
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.
这个应该也可以在前面直接加 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.
呃,我在python runtime中测试,这部分字符串加 r
与不加 r
并不等价。按理说注释应该不影响,但是因为不知道会不会引起CI报错就先采用的这样保守的修改方式。
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.
喔喔我没注意到这是那个会引起示例代码错误的字符串,这个可以先回撤掉,之后单独一个 PR 修改即可
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.
之后单独一个 PR 修改即可
#47152 正在将这个 API 从 incubate 移出去,应该能够修复这里示例代码的问题,这处修复可以等该 PR merge 后再做
PR-CI-Build 貌似卡住了,导致其余三个也卡住了,re-run 下估计就可以过了,Kunlun 和 APPROVAL 最好也 re-run 下
PR types
Others
PR changes
Others
Describe
Add escape symbol to some strings
在字符串注释前添加自动转义符号,添加原因见:cattidea/paddle-flake8-project#66 和 #46752 (comment)
Related Links:
Flake8 tracking issue: #46039
配置文件更新: #46753
Fix: cattidea/paddle-flake8-project#66