开发者

Sphinx autodoc integrate decorated properties

I started using Sphinx for documenting my sqlalchemy-driven app.

One of typical uses of SA in attribute manipu开发者_开发技巧lation is using hybrid-property decorator.

Now my problem is I get no doc entry for name:

class User(GeneralTable):
    '''User'''
    ...
    @hybrid_property
    def name(self):
        '''
        User name

        :rtype: unicode
        '''
        if self._name is None:
            return 'anonymous'
        else:
            return self._name

    @name.setter
    def name(self, name):
        '''
        :type name: unicode
        '''
        self._name = name

while changing hybrid_property to standard property I get it documented.

Is there a way to extend Sphinx to adopt with hybrid_property the same property behavior?

My current workaround is to put a name .. attribute:: entry in User class doc.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜