On 21 fév, 15:53, Georg Brandl <[email protected]> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Am 04.02.2010 13:04, schrieb pipoun:
>
>
>
> > Hi all,
>
> > I've got a strange behavior with sphinx and autodoc, regarding the
> > documentation of some module attributes.
>
> > here is the .txt
> > .. automodule:: mymodule
> >     :members:
> >     :undoc-members:
> >     :show-inheritance:
>
> > here is the .py
>
> > from enum import Enum
> > #: doc enum
> > EFooBar = Enum("FOO", "BAR")
> > #: doc enum 2
> > EFooBar2 = "string"
> > #: foo
> > g_FOO = EFooBar.FOO
> > #: foo 2
> > g_FOO2 = 1
>
> > In the html file, I only have doc for EFooBar2 and g_FOO2 and nothing
> > for EFooBar nor g_FOO
>
> > I can add a .. attribute:: g_FOO in the class docstring, but they are
> > not placed in the same groups of attributes than EFooBar2 and g_FOO2
> > (in the html file).
> > autodoc_member_order is set to 'groupwise'
>
> > I'm using the latest code from the mercurial repository.
>
> This may be caused by the specific Enum class you're using. Could you
> show me how enum.py looks?

Thanks for your answer. I'm using the enum module from pypi:
http://pypi.python.org/pypi/enum/

There's only one module. Here is the Enum constructor, dunno if it can
help at first sight (there's a EnumValue class to look at perhaps
too):

    def __init__(self, *keys, **kwargs):
        """ Create an enumeration instance. """

        value_type = kwargs.get('value_type', EnumValue)

        if not keys:
            raise EnumEmptyError()

        keys = tuple(keys)
        values = [None] * len(keys)

        for i, key in enumerate(keys):
            value = value_type(self, i, key)
            values[i] = value
            try:
                super(Enum, self).__setattr__(key, value)
            except TypeError:
                raise EnumBadKeyError(key)

        self.__dict__['_keys'] = keys
        self.__dict__['_values'] = values

By the way, I think this behavior might be reproducible with variables
assigned to a class instance.

Thanks again,
Pierre

>
> Thanks,
> Georg
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v2.0.14 (GNU/Linux)
>
> iEYEARECAAYFAkuBSOAACgkQN9GcIYhpnLDYJgCbBUxnT09aIZfy1EDEKRvAsLdd
> NcIAoLAilJpCFAvTq8dVVrC9Rfu8PIT5
> =m8K6
> -----END PGP SIGNATURE-----

-- 
You received this message because you are subscribed to the Google Groups 
"sphinx-dev" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sphinx-dev?hl=en.

Reply via email to