Python Appengine模型属性docstring

Python Appengine模型属性docstring,python,google-app-engine,python-sphinx,Python,Google App Engine,Python Sphinx,我正在使用几个appengine模型和autodoc。但是我找不到 获取要应用的属性文档的方法。我正在使用和构建文档 例如,对于模型: class Greeting(ndb.Model): """Models an individual Guestbook entry with content and date.""" content = ndb.StringProperty() date = ndb.DateTimeProperty(auto_now_add=True) 内容的结

我正在使用几个appengine模型和autodoc。但是我找不到 获取要应用的属性文档的方法。我正在使用和构建文档

例如,对于模型:

class Greeting(ndb.Model):
  """Models an individual Guestbook entry with content and date."""
  content = ndb.StringProperty()
  date = ndb.DateTimeProperty(auto_now_add=True)
内容的结果docstring为

一种索引属性,其值是长度有限的文本字符串

我尝试了以下方法:

  "The content"
  content = ndb.StringProperty()

  content = ndb.StringProperty()
  "The content"

  #: the content
  content = ndb.StringProperty()

  content = ndb.StringProperty()
  content.__doc__="The content"

  content = ndb.StringProperty(__doc__="the content")

  content = ndb.StringProperty(doc="the content")
它们都没有给出错误或工作-我总是得到“索引属性…”。我很惊讶 显式设置_udoc__;没有效果


知道如何使用我自己的docstring吗?

答案是斯芬克斯很好用。我看到的是没有重建的文档输出的错误副本。这两项工作:

content = ndb.StringProperty()
"The content"

#: the content
content = ndb.StringProperty()

不是Sphinx方面的专家,但我希望您能够在类docstring本身中记录字段。@DanielRoseman在代码中记录字段是正常的。它适用于普通班,真的吗?不是我用过的任何文档格式。我不能在注释中显示它,但作为一个示例,请参见(向下滚动一点以进入“类”小节),其中在类级别的docstring中包含一个Attributes部分。Sphinx确实允许您使用docstring来记录属性。本例中的问题是pebkac,两种不同的语法起作用。