Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/340.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python Sphinx autodoc,包括类和方法_Python_Python Sphinx_Autodoc_Sphinx Apidoc - Fatal编程技术网

Python Sphinx autodoc,包括类和方法

Python Sphinx autodoc,包括类和方法,python,python-sphinx,autodoc,sphinx-apidoc,Python,Python Sphinx,Autodoc,Sphinx Apidoc,我有python类,其中一些在它们自己的文件中 i、 e.userdata.py: class userdata: """User input class for reading...""" def __init__(self, fname): self.fname = fname def trykey(self,name,injson): .... 我尝试了多种方法来引用文档中该类中的特定方法,但都不起作用 我正在通过命令生成au

我有python类,其中一些在它们自己的文件中

i、 e.userdata.py:

class userdata:
    """User input class for reading..."""

    def __init__(self, fname):
        self.fname = fname        


    def trykey(self,name,injson):
....
我尝试了多种方法来引用文档中该类中的特定方法,但都不起作用

我正在通过命令生成autodoc

sphinx-apidoc 
它只为上面的代码生成模块

_lib.io package
=====================

Submodules
----------

.. toctree::

   lib.io.userdata

Module contents
---------------

.. automodule:: lib.io
    :members:
    :undoc-members:
    :show-inheritance:
具有多个类的模块的类似问题 i、 e.ad1.py

class inner1(inherited)
....
class inner2(inherited)
....def
....
自动文档:

_lib.ad.ad1 module
===========================================

.. automodule:: lib.ad.ad1
    :members:
    :undoc-members:
    :show-inheritance:

是否有一种方法可以自动生成autoclass和automethod

请注意,sphinx apidoc仅生成
automodule
指令。如果要使用
autoclass
autofunction
,必须手动添加这些指令。为了准确地理解你的问题是什么,我们需要更多的细节(最好是以a的形式)。好的,那么就我所知,答案是否定的。谢谢,您不必使用
自动类
自动方法
。只使用
automodule
应该可以。@mzjn您认为只使用
automodule
可以显示模块中每个类的类docstring吗?对于模块中定义的函数也是如此?@Ecuashungo您应该添加
:members:
选项。