【问题标题】:How to make sphinx specify full module path for documented parameters?如何让 sphinx 为记录的参数指定完整的模块路径?
【发布时间】:2022-06-18 20:56:31
【问题描述】:

我正在使用 sphinx 来自动记录一个类。构造函数看起来像这样:

from PyQt6.QtCore import QEasingCurve

class MyClass:
    def __init__(animationType=QEasingCurve.Type.OutCubic):
        # constructor function

当我为这个类生成文档时,animationType 参数记录如下:

我不希望它像这样只指定一半的路径。我想让它说animationType=PyQt6.QtCore.Qt.QEasingCurve.Type。我该怎么做?

这是我的 reStructuredText 源文件的样子:

MyClass
=======

.. automodule:: MyModule.MyClass
   :members:
   :undoc-members:
   :show-inheritance:

【问题讨论】:

    标签: python python-sphinx restructuredtext autodoc


    【解决方案1】:

    只需导入 PyQt6 并在你的 coe 中使用PyQt6.QtCore.Qt.QEasingCurve.Type

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-11-20
      • 1970-01-01
      • 1970-01-01
      • 2019-10-31
      • 2014-10-14
      • 2021-10-04
      相关资源
      最近更新 更多