【问题标题】:Documentation after members in python (with doxygen)python中成员之后的文档(使用doxygen)
【发布时间】:2012-06-18 18:28:27
【问题描述】:

我正在使用 doxygen 并有以下代码:

def __init__(self):
    '''

    '''
    if not '_ready' in dir(self) or not self._ready:
        self._stream = sys.stderr   ##!< stream to which all output is written
        self._ready = True          ##!< @internal Flag to check initialization of singelton

由于某种原因,doxygen 告诉我 self._stream (Member _stream) 是无证的。我可以用评论记录它吗,就像Putting documentation after members 中描述的 doxygen 文档一样,如果是这样,正确的方法是什么?

**edit:**这似乎与我没有换行有关,例如这里:

class escapeMode(object):
    '''
    Enum to represent the escape mode.
    '''
    ALWAYS      = 1     ##!< Escape all values
    NECESSARY   = 2     ##!< Escape only values containing seperators or starting with quotation

Doxygen 只抱怨 ALWAYS 没有记录,我想避免在我记录的每个新属性后面插入换行符,因为它破坏了换行符的值,用于将循环或 if 语句与周围代码分开的逻辑块

【问题讨论】:

  • 我建议一般使用Sphinx 来记录 Python 项目
  • 不幸的是,目前这不是一个选项,我会看看下一个项目
  • 可能是一个拼写检查工具抱怨ALLWAYS ;)

标签: python doxygen


【解决方案1】:

这在 doxygen 中目前不受支持,正如之前回答的 here。 如果您将评论放在前面的行中,它将正常工作:

class escapeMode(object):
    '''
    Enum to represent the escape mode.
    '''
    ## Escape all values
    ALLWAYS     = 1
    ## Escape only values containing seperators or starting with quotation
    NECESSARY   = 2

希望还不算晚……

【讨论】:

  • 谢谢,这有点帮助。我对 python 的过滤器做了一些修改。它做同样的事情,但它搞砸了行号,因为它在内部将其转换为您的格式但使用文档字符串,从而添加行。如果我的雇主允许,我会更改它并尝试将其上传到某个地方。
猜你喜欢
  • 2013-04-01
  • 2014-08-13
  • 2016-11-21
  • 2014-05-01
  • 2011-11-11
  • 2016-05-11
  • 2023-03-15
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多