简体   繁体   中英

How to make epydoc show parameters in function prototype?

Using epydoc, version 3.0.1.

I tried this simple thing :

def SetNetwork(self, PyLabNetwork net):
    """
    Set the net !!!
    @param self: How long they should think.
    @type self: C{int} or L{PyLabNetwork}
    @param net: How long they should think.
    @type net: C{int} or L{PyLabNetwork}
    """
    self.network = net

Ran this :

epydoc -v -o ./html --name epydoc --css white --docformat epytext cyelp

But in the html produced by epydoc, the methods prototype still appears with 3 successive dots instead of the described parameters :

SetNetwork(...) << ??? NOTHING INSIDE ???

Set the net !!!

Parameters:

        self (int or PyLabNetwork) - How long they should think.
        net (int or PyLabNetwork) - How long they should think.

Any idea ? Thanks a lot

EDIT : Sorry, I just tested a simple script that work perfectly. The previous case didn't work because it is a shared object (.so) compiled with Cython. It makes a difference. The source cannot be displayed either. I thought epydoc was working only on the docstrings, regarding the parsing of the functions prototype, but it appears to be a little bit more complicated than that...

EDIT2 : Moreover, if I compile passing the "embedsignature" cython compilation directive to "True", I get something - which is still wrong but I understand better the phenomenon :

SetNetwork(...)


PyLabNode.SetNetwork(self, PyLabNetwork net)

Set the net !!!

Parameters:

        self (int or PyLabNetwork) - How long they should think.
        net (int or PyLabNetwork) - How long they should think.

Aka : epydoc doesn't understand the cythonized signatures the way they are embedded...

If you have more specific explanations, I'm still your man. Thanks

Got it.

I removed the cython compilation directive, which was sending signatures that epydoc could not understand like :

PyLabNode.SetNetwork(self, PyLabNetwork net)

This has 2 drawback : The dotted notation for the class prefix and the typed parameter.

And replaced it by a python well formed one as the very first line of the doc string, giving :

def SetNetwork(self, PyLabNetwork net):
    """
    SetNetwork(self, net)
    Set the net !!!
    @param self: Handler to this.
    @type self: L{PyLabNode}
    @param net: The network this node belongs to.
    @type net: L{PyLabNetwork}
    """
    self.network = net

That did the trick. Hope this can help some people.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM