了解命名空间文档

发布于 2025-01-02 15:33:46 字数 938 浏览 3 评论 0原文

我正在努力理解 doxygen 如何与 Python 中的命名空间一起工作。默认情况下会生成名称为“filename”的命名空间,即 temp.py。我还可以使用 \package\namespace 命令声明新的命名空间。

但是,我不明白的是为什么下面的类(或任何其他定义)总是出现在 temp 命名空间下?

请帮助我了解命名空间命令在 doxygen 中的工作原理。

如果您知道 doxygen 中如何以及为何使用 /namespace pr /package 命令,您可以绕过下面的示例并直接回答。

#filename = temp.py
##\mainpage Main Page Title
#\brief main page title comments  \n




## class class_demo1 \n
#  the class declared below \n
class class_demo1:
        pass

from new_package import *

现在,我添加了一个名为 \new_package 的新命名空间,添加在 temp.py 文件中,

##\package new_package
#new namespace comments \n

我还创建了一个名为 \new_package.py 的文件,并在其中添加了以下行:

def demo_fun:
    pass

class demo_class:
    pass

在生成的文档中,我在命名空间 \temp 下得到 \class_demo1。 但是,新的命名空间 \new_package.py 不显示在下面声明的类和 def 它。

I am struggling to understand how doxygen works with namespaces in Python. A namespace of the name "filename" i.e. temp.py, is generated by default. I can also declare new namespaces with the \package or \namespace command.

However, what I don't understand is why the class below (or any other definition) always appears under the temp namespace?

Please help me understand how the namespace command works in doxygen.

If you know how and why /namespace pr /package commands are used in doxygen, you can bypass the example below and directly answer it.

#filename = temp.py
##\mainpage Main Page Title
#\brief main page title comments  \n




## class class_demo1 \n
#  the class declared below \n
class class_demo1:
        pass

from new_package import *

Now, I am adding a new namespace by the name \new_package , added to the temp.py file

##\package new_package
#new namespace comments \n

I have also created a file named \new_package.py and added the below lines in it:

def demo_fun:
    pass

class demo_class:
    pass

In the generated documentation, I get \class_demo1 under namespace \temp.
However, the new namespace \new_package.py doesn't display the class and def declared under
it.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

在巴黎塔顶看东京樱花 2025-01-09 15:33:46

如果在 new_package.temp 模块中定义了 Demo 类,则将它放入 new_package 命名空间中:

new_package/
├── __init__.py
│   #   from .temp import Demo
└── temp.py
    #   class Demo:
    #       pass

在这种情况下,doxygen 只需要反映以下关系:已经在代码中了。

To put Demo class into new_package namespace if it is defined in new_package.temp module:

new_package/
├── __init__.py
│   #   from .temp import Demo
└── temp.py
    #   class Demo:
    #       pass

In this case doxygen would need just to reflect the relation that is already in the code.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文