如何从doxygen中排除python代码中的某些方法?

时间:2018-09-28 11:09:44

标签: python doxygen

我想从python代码创建doxygen文档,但是我想从类中排除某些方法。

我没有在doxygen配置文件中找到直接排除类方法的任何东西,但是我在here上发现了问题4。因此,在配置中,我设置了:

2018-10-02T06:47:43.191640+00:00 app[api]: Release v1 created by user kailauber@icloud.com
2018-10-02T06:47:43.308759+00:00 app[api]: Enable Logplex by user kailauber@icloud.com
2018-10-02T06:47:43.191640+00:00 app[api]: Initial release by user kailauber@icloud.com
2018-10-02T06:47:43.308759+00:00 app[api]: Release v2 created by user kailauber@icloud.com
2018-10-02T06:58:36.000000+00:00 app[api]: Build started by user kailauber@icloud.com
2018-10-02T06:58:37.000000+00:00 app[api]: Build failed -- check your build logs
2018-10-02T07:03:40.000000+00:00 app[api]: Build started by user kailauber@icloud.com
2018-10-02T07:03:42.000000+00:00 app[api]: Build failed -- check your build logs
2018-10-02T07:09:04.000000+00:00 app[api]: Build started by user kailauber@icloud.com
2018-10-02T07:09:54.741609+00:00 app[api]: Release v3 created by user kailauber@icloud.com
2018-10-02T07:09:54.741609+00:00 app[api]: Deploy 0c3d9616 by user kailauber@iclud.com
2018-10-02T07:09:59.000000+00:00 app[api]: Build succeeded
2018-10-02T07:16:48.138432+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/" host=trapnationbot.herokuapp.com request_id=6aced25b-f8c4-460e-8c1b-8f8794d40d2f fwd="89.217.251.114" dyno= connect= service= status=503 bytes= protocol=https
2018-10-02T07:16:48.457466+00:00 heroku[router]: at=error code=H14 desc="No web rocesses running" method=GET path="/favicon.ico" host=trapnationbot.herokuapp.com request_id=dd99c34d-0bbc-46b8-b9c9-ee2418cf8cc4 fwd="89.217.251.114" dyno= connect= service= status=503 bytes= protocol=https
2018-10-02T07:16:48.493293+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/favicon.ico" host=trapnationbot.herokuapp.com request_id=47ec0871-d865-4ea4-93b1-d96e5782ccc2 fwd="89.217.251.114" dyno= connect= service= status=503 bytes= protocol=https
2018-10-02T07:18:52.707524+00:00 app[api]: Release v4 created by user kailauber@icloud.com
2018-10-02T07:18:52.707524+00:00 app[api]: Set token config vars by user kailauber@icloud.com
2018-10-02T07:19:58.616740+00:00 heroku[router]: at=error code=H14 desc="No web rocesses running" method=GET path="/" host=trapnationbot.herokuapp.com request_id=f9116de7-d7f2-4354-b188-09624ed4c482 fwd="89.217.251.114" dyno= connect= servce= status=503 bytes= protocol=https
2018-10-02T07:20:35.194420+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/" host=trapnationbot.herokuapp.com request_id=1ae1bc26-39a2-482a-87cc-12149d45a89d fwd="89.217.251.114" dyno= connect= service= status=503 bytes= protocol=http
2018-10-02T07:20:35.382931+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/favicon.ico" host=trapnationbot.herokuapp.com request_id=01d7c808-b8ca-4c82-a4b4-b0697541264f fwd="89.217.251.114" dyno= connect= service= status=503 bytes= protocol=http
2018-10-02T07:20:35.390361+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/favicon.ico" host=trapnationbot.herokuapp.com request_id=3e2ed998-d89f-4961-b629-0dadcb00c89d fwd="89.217.251.114" dyno= connect= service= status=503 bytes= protocol=http
2018-10-02T08:01:08.132111+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/" host=trapnationbot.herokuapp.com request_id=0cf0fb63-b02b-43d8-90a2-3a6526d8c96d fwd="89.217.251.114" dyno= connect= service= status=503 bytes= protocol=https
2018-10-02T09:50:43.236146+00:00 app[api]: Release v5 created by user kailauber@icloud.com
2018-10-02T09:50:43.236146+00:00 app[api]: Remove token config vars by user kailuber@icloud.com
2018-10-02T09:50:57.411848+00:00 app[api]: Set token config vars by user kailauber@icloud.com
2018-10-02T09:50:57.411848+00:00 app[api]: Release v6 created by user kailauber@icloud.com
2018-10-02T09:51:14.652913+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/favicon.ico" host=trapnationbot.herokuapp.com request_id=048ef97b-f342-47b6-9266-d77926934cc2 fwd="176.127.140.95" dyno= connect= service= status=503 bytes= protocol=https
2018-10-02T09:51:14.671402+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/favicon.ico" host=trapnationbot.herokuapp.com request_id=23759f86-fd20-442c-b8db-dfa3163140ab fwd="176.127.140.95" dyno= connect= service= status=503 bytes= protocol=https
2018-10-02T09:51:14.470107+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/" host=trapnationbot.herokuapp.com request_id=02385247-7c6f-4e6f-a6b8-b1c89e4e8a02 fwd="176.127.140.95" dyno= connect= service= status=503 bytes= protocol=https
2018-10-02T09:58:22.000000+00:00 app[api]: Build started by user kailauber@icloud.com
2018-10-02T09:59:17.578544+00:00 app[api]: Deploy 7161d06f by user kailauber@icloud.com
2018-10-02T09:59:17.578544+00:00 app[api]: Release v7 created by user kailauber@icloud.com
2018-10-02T09:59:21.000000+00:00 app[api]: Build succeeded
2018-10-02T10:00:07.539714+00:00 app[api]: Scaled to worker@1:Free by user kailauber@icloud.com
2018-10-02T10:00:11.688081+00:00 heroku[worker.1]: Starting process with command `node bot.js`
2018-10-02T10:00:12.363320+00:00 heroku[worker.1]: State changed from starting to up
2018-10-02T10:00:13.702632+00:00 heroku[worker.1]: State changed from up to crashed
2018-10-02T10:00:13.704665+00:00 heroku[worker.1]: State changed from crashed totarting
2018-10-02T10:00:13.690858+00:00 heroku[worker.1]: Process exited with status 127
2018-10-02T10:00:13.631854+00:00 app[worker.1]: bash: node: command not found
2018-10-02T10:00:14.828142+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/" host=trapnationbot.herokuapp.com request_id=7403214c-8e37-488c-b674-0b6255f8af52 fwd="176.127.140.95" dyno= connect= service= status=503 bytes= protocol=https
2018-10-02T10:00:18.760188+00:00 heroku[worker.1]: Starting process with command `node bot.js`
2018-10-02T10:00:19.575651+00:00 heroku[worker.1]: State changed from starting to up
2018-10-02T10:00:21.292435+00:00 heroku[worker.1]: Process exited with status 127
2018-10-02T10:00:21.307843+00:00 heroku[worker.1]: State changed from up to crashed
2018-10-02T10:00:21.213892+00:00 app[worker.1]: bash: node: command not found

在我做的代码中

<style>
img{
  height: 100%;
  object-fit: cover;
}
</style>
 <a class="elementor-post__thumbnail__link" href="">
    <div class="elementor-post__thumbnail">
        <img src="">
    </div>
 </a>

要从文档中排除ENABLE_PREPROCESSING = YES PREDEFINED = DOXYGEN_SHOULD_SKIP_THIS 方法,我再次运行#ifndef DOXYGEN_SHOULD_SKIP_THIS def log(text): .... ... #endif /* DOXYGEN_SHOULD_SKIP_THIS */ ,但是没有预期的结果。 log的文档仍在文档中……

我在做什么错?如何正确排除某个方法被记录在文档中或出现在调用者/ calee图形中?

2 个答案:

答案 0 :(得分:1)

提到的文档有些过时(从1.3.5版开始,即从2004年开始;当前是1.8.14版)。请始终使用http://www.doxygen.nl上的官方文档。

并不是所有语言都可以进行预处理,而对于python来说并不是这样(据我所知,python没有任何预处理功能)。

当前文档指出:

18.5如何使doxygen忽略某些代码片段?

最简单的新方法是在代码段的开头添加一个用\cond命令添加一个注释块,并在代码的末尾添加一个\endcond命令添加一个注释块。当然,这应该在同一文件中。 但是您也可以为此使用doxygen的预处理器: 如果你放

#ifndef DOXYGEN_SHOULD_SKIP_THIS
/* code that must be skipped by doxygen */
#endif /* DOXYGEN_SHOULD_SKIP_THIS */

应隐藏并放置的块周围:

PREDEFINED = DOXYGEN_SHOULD_SKIP_THIS

在配置文件中,只要ENABLE_PREPROCESSING设置为YES,所有的块都应被doxygen跳过。

一个有效的例子:

def log_shown(text):
    pass

##\cond
def log_not_shown(text):
    pass
##\endcond

请注意,由于示例中缺少文档,您必须将配置项EXTRACT...设置为YES

有关\cond\endcond的信息,请参见文档,并查看配置设置:ENABLED_SECTIONS

答案 1 :(得分:0)

您可以尝试使用过滤器(请参见filters4Doxygen)作为预处理器来获得结果。

您必须为pyton制作一个自定义过滤器(用作示例BATdoxFilter.bat(sh)): 过滤器“排除”将使用正则表达式在bin / rgx / excpt.RGX中定义:

## rule 1, /*skip*/.../*endskip*/  is destroid
regex1=(?mis)/\\*skip(.)*?endskip\\*/
replacement1=

注意:我没有测试过正则表达式,因此可能需要进行一些调整:请参见https://github.com/msillano/regexfilter/blob/master/README.pdf

我希望能对您有所帮助。

最好的问候,女士。