微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

为继承 param.Parameterized

如何解决为继承 param.Parameterized

我正在尝试为我正在制作的某些软件创建文档,但遇到了以下问题。我的任何继承自 param.Parameterized repo here 的类最终都会在我编写的 Docstring 内容之后以纯文本形式编写 param 的“迷你”文档。

如上面的屏幕截图所示,通过一个小例子,生成的结果如下:


Parameters

    exampleType

        Example parameter

Attributes

    exampleType

        Example attribute
    [1;32mParameters of ‘Example’
    =======================
    [0m
    [1;31mParameters changed from their default values are marked in red.[0m
    [1;36mSoft bound values are marked in cyan.[0m
    C/V= Constant/Variable,RO/RW = ReadOnly/ReadWrite,AN=Allow None
    [1;34mName Value Type Bounds Mode [0m
    test False Boolean (0,1) V RW
    [1;32mParameter docstrings:
    =====================[0m
    [1;34mtest: < No docstring available >[0m


我的 conf.py 包含:

import os
import sys

sys.path.insert(0,os.path.abspath("."))

project = "example"
copyright = ""
author = ""

extensions = [
    "sphinx.ext.napoleon","sphinx.ext.autodoc","sphinx.ext.todo","sphinx.ext.coverage","numpydoc",]

numpydoc_show_class_members = False
numpydoc_show_inherited_class_members = False

autodoc_default_options = {
    "show-inheritance": False,}

templates_path = ["_templates"]

exclude_patterns = ["_build","Thumbs.db",".DS_Store"]

html_theme = "sphinx_rtd_theme"

html_static_path = ["_static"]

我的 index.rst 是:

Welcome to Documentation!
========================================

.. autoclass:: example.Example
   :members: example_method

我的example.py包含:

import param

class Example(param.Parameterized):
    """Example Class.

    Parameters
    ----------
    example : Type
        Example parameter


    Attributes
    ----------
    example : Type
        Example attribute

    """

    test = param.Boolean()

    def __init__(self):

        testing = True

    def example_method(self,example):
        """Example Method.

        Parameters
        ----------
        example : Type
            Example parameter


        Returns
        ----------
        None

        """

        testing = True

我不确定问题出在 param 类还是 sphinx,所以如果有人知道如何关闭文档的这一额外部分,我将不胜感激。

内置文档:

The built documentation

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。