-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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]fix cleandoc with a first blank line #55052
Conversation
你的PR提交成功,感谢你对开源项目的贡献! |
我的意思是在这个 PR 里加上 #54879 |
如果这边通过了,会同步 merge docs 下的相应 PR |
好了, 看看行不~ |
python/paddle/metric/metrics.py
Outdated
.. code-block:: python | ||
:name: code-standalone-example |
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.
LGTM
相关流水线已过 🎉
merge 一下 develop 吧,PR-CI-Windows-Inference 问题 develop 已解决 |
PR types
Bug fixes
PR changes
Others
Description
修复
extract_code_blocks_from_docstr
里面的inspect.cleandoc
不能正确处理code-block
第一行的缩进问题。参考 PEP 257 – Docstring Conventions
inspect.cleandoc
这个方法本来不是为 code 准备的,而是为 docstring 使用的。而,docstring 中,默认第一行的缩进是无意义的:
也就是说,这个方法是按照第二行的缩进进行删减的,从而导致,如下的代码块可以正常解析:
而,如下的代码块缩进会出问题:
修改后,默认添加一个空行,由此可以正常解析:
关联 PR :
单测在 docs 那边的 PR 里面,这里就不放了~
@SigureMo 请评审!