草庐IT

thinking-sphinx

全部标签

python - 属性的 Sphinx 值报告为无

当我使用Sphinxautodoc来记录一个类时,总是会报告属性的值(正如它所说的那样here,在#437下)但总是“=None”Attribute=NoneSomeDocumentation我把它包括在内..autoclass::core.SomeClass:members:我的代码看起来像classSomeClass(object):def__init__(self):self.attribute="value"#:SomeDocumentation有没有办法让“=None”报告真实值,或者让它消失? 最佳答案 会有一个:ann

python - 在 Sphinx 文档中显示*仅*文档字符串?

Sphinx有一个名为automethod的功能,它可以从方法的文档字符串中提取文档并将其嵌入到文档中。但它不仅嵌入了文档字符串,还嵌入了方法签名(名称+参数)。如何仅嵌入文档字符串(不包括方法签名)?引用:http://www.sphinx-doc.org/en/master/usage/extensions/autodoc.html 最佳答案 我想你要找的是:fromsphinx.extimportautodocclassDocsonlyMethodDocumenter(autodoc.MethodDocumenter):def

python - 是否可以针对特定功能覆盖 Sphinx autodoc?

我正在使用Sphinx的autodoc插件来自动记录一组模块。我有一个接受*args的函数,我想覆盖文档以显示更好的funcname(arg1[,arg2[,...]])Pythonstdlib文档使用的样式。是否可以覆盖特定函数的autodoc输出? 最佳答案 可以使用autofunction覆盖签名:..automodule::yourmodule:members::exclude-members:funcname..autofunction::funcname(arg1[,arg2[,...]])但是,具有覆盖签名的函数不会与

python - Sphinx Autodoc 从文档字符串中跳过成员

我正在用Sphinx记录一个类,只是想跳过其中一个类成员:classStatusUpdateAdapter(logging.LoggerAdapter):""""""def__init__(self,status_update_func,logger,extra={}):""""""passdeflog(self,*args,**kwargs):pass如何使sphinx不记录日志成员?如果可能,我想在StatusUpdateAdapter或日志文档字符串中执行此操作。 最佳答案 现在(从0.6版开始)您可以使用:exclude-m

python - 如何覆盖 Sphinx 插入的英文标签

我使用SphinxPythondocumentationgenerator.创建PDF文档非常容易和简单,但我有一个问题。所有生成的PDF文档都有英文单词,例如“chapter”、“release”和“part”。我怎样才能用另一种语言覆盖这些英文标签,或者完全删除它们? 最佳答案 在您的conf.py中,有以下段落(在sphinx-quickstart创建的conf.py的第57行附近):#ThelanguageforcontentautogeneratedbySphinx.Refertodocumentation#foralis

python - OptionParser 是否与 Sphinx 冲突?

我正在尝试为我在Sphinx中的项目编写文档,每当Sphinx在我的模块中遇到OptionParser时,它都会给我:sphinx-build:error:nosuchoption:-b我认为这是不可能的,所以我写了一个简单的模块来检查这个:fromoptparseimportOptionParser"""somecommenthere"""parser=OptionParser(conflict_handler='resolve')parser.add_option('','--force',action='store_true',dest='force',default=False

python - Sphinx——结合自动模块和自动类

除非我遗漏了什么,否则Sphinx的automodule只会记录模块的成员,而不是该模块中定义的类的属性。有没有办法自动获取automodule和autoclass的行为,这样我就可以自动获取模块的文档成员和在该模块中找到的任何类的属性?我知道我可以编写所有这些,但它很快就会变得非常困惑和冗长。如果有人有一种巧妙、优雅的方式来做到这一点,我也很乐意听到。 最佳答案 ..automodule::whatever:members: 关于python-Sphinx——结合自动模块和自动类,我们

python - 我如何为 namedtuple(使用 autodoc)提供 Sphinx 文档?

我正在尝试使用Sphinx记录一个Python项目,但我无法将autodoc扩展与namedtuple生成的类结合起来。在一个文件gammatone.rst中,我有::mod:`gammatone`--gammatonefilterbanktoolkit================================================..automodule::gammatone:members:..automodule::gammatone.coeffs:members:在我的gammatone/coeffs.py中,我有:fromcollectionsimportna

Python Sphinx 自动摘要 : Automated listing of member functions

我如何告诉自动摘要扩展不仅列出一个类,还列出所有类的成员?如果我使用:..autosummary::MyClass在生成的html文件中,只有一个简短的摘要,如:MyClass(var1,var2,....)我的自定义类可以做一些奇特的事情...我真正想要的是这样的:MyClass(var1,var2,....)我的自定义类可以做一些奇特的事情...MyClass.doA(var1,var2,...)做得很好MyClass.doB(var1,var2,...)B是否更好我必须如何配置自动摘要指令才能获得此信息(除了在自动摘要指令中自己对所有函数进行繁琐的命名之外)?谢谢!

python - Sphinx autodoc 给出警告 : py:class reference target not found: type warning

我有一些在python中使用元类的代码。但是当sphinxautodoc运行时它给出了错误:警告:py:classreferencetargetnotfound:type错误发生在自动生成的.rst文件的一行中:..automodule::API.list.blockList:members:#thisisthelineinerror:show-inheritance:blockList扩展了API.list.list,其中\__metaclass__设置为我的元类。据我所知,sphinx认为内置类型类不存在。我试过导入内置类型以使sphinx意识到它的存在,但没有奏效。如果我从API