Python 如何省略Sphinx上变量的值?

Python 如何省略Sphinx上变量的值?,python,python-sphinx,documentation-generation,Python,Python Sphinx,Documentation Generation,我有一些模块级变量,这些变量的值很长,而且没有意思,我想从自动生成的文档中排除它们。有办法做到这一点吗 例如,在我的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 go

我有一些模块级变量,这些变量的值很长,而且没有意思,我想从自动生成的文档中排除它们。有办法做到这一点吗

例如,在我的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源代码中是否有针对特定变量执行此操作的方法;我可以在Sphinx源代码中为整个模块或单个变量执行此操作吗?

我可以想到两种解决方案:

  • 使用monkey修补程序截断此答案中建议的长变量值:

  • 使用带有选项的
    autodata
    记录模块级变量


也许你可以用这个:@mzjn:这比我希望的要多。没有我可以添加到变量中的装饰器。或者RST中有一个标志?有一个“注释”选项,但它只适用于
autodata
autoattribute
:@mzjn:这看起来像一个答案!这并不完美,因为我需要放弃自动记录会员;但如果这就是全部,它会有用的。