2014-09-24 46 views
1

我有一些模块级别的变量,我想从自动生成的文档中排除很长且无趣的值。有没有办法做到这一点?如何省略Sphinx上的变量值?

例如,在我的Python源我有类似

#:This is a variable with a log value. 
long_variable = "Some really long value that is not really of interest and just kind of gets in the way of reading and understanding what's going on." 

,并在我的狮身人面像源我有

.. automodule:: the_module 
    :members: 

,我想的文档,省略变量值。

如何省略Sphinx上的变量值?有没有办法在Python源代码中为特定变量执行此操作?我可以在狮身人面像源中为整个模块或单个变量执行吗?

+0

也许你可以使用这个:http://stackoverflow.com/a/25163963/407651 – mzjn 2014-09-25 15:52:48

+0

@mzjn:这比我所希望的要多。有没有我可以添加到变量的装饰器。或者可能是RST的一面旗帜? – orome 2014-09-25 16:52:41

+1

有一个“注释”选项,但它只适用于'autodata'和'autoattribute':http://sphinx-doc.org/ext/autodoc.html?highlight=autodata#directive-autodata – mzjn 2014-09-25 17:08:53

回答