Skip to content
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

[Change] remove doctest directives from sphinx conf #6072

Merged
merged 3 commits into from
Jul 28, 2023

Conversation

megemini
Copy link
Contributor

PR types

Others

PR changes

Others

Description

去掉文档中示例代码的 >>> # doctest: XXX 相关行

@paddle-bot
Copy link

paddle-bot bot commented Jul 28, 2023

感谢你贡献飞桨文档,文档预览构建中,Docs-New 跑完后即可预览,预览链接:http://preview-pr-6072.paddle-docs-preview.paddlepaddle.org.cn/documentation/docs/zh/api/index_cn.html
预览工具的更多说明,请参考:飞桨文档预览工具

@megemini
Copy link
Contributor Author

megemini commented Jul 28, 2023

@SigureMo
Copy link
Member

可是中文文档没有 ~

我刚刚在看中文的,原来英文是没问题的嘛?

这是中文 repo,为啥会不触发中文的呢,很奇怪

@SigureMo
Copy link
Member

我大概知道了,autodoc 是用来从英文文档(docstring)自动生成 rst 的 extension,这个 API 应该仅仅针对 docstring 有效,对于中文文档,COPY FROM 应该是插入到 rst 里,它不是 autodoc 生成的,这个 API 不会影响它……

所以有一种方案,就是在 COPY FROM 时候预处理一下这个代码,只是看起来有点不协调,两者使用了不同的处理方式,但应该能用 dbd7634bed184f29ebab0cf36d7cd3a3

@megemini
Copy link
Contributor Author

打了个补丁 ... ... 收工 ~

Copy link
Member

@SigureMo SigureMo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

其余 LGTM~

"""
Remove `doctest` directives from docstring
"""
import re
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

按照 python 的规范,import 如非必要放在文件开头吧

@@ -375,6 +375,18 @@ def linkcode_resolve(domain, info):
return None


def remove_doctest_directives(app, what, name, obj, options, lines):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

既然中文用不上,相关修改就删掉吧

Copy link
Member

@SigureMo SigureMo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM~

@SigureMo SigureMo merged commit 96d13d2 into PaddlePaddle:develop Jul 28, 2023
1 check passed
@sunzhongkai588
Copy link
Collaborator

打了个补丁 ... ... 收工 ~

@megemini 坏了顺师傅,现在是中文没空行,但英文有空行,以 all_reduce 为例

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants