-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Denis schrieb:
> Hi,
> 
> Adding this snippet to conf.py works for me - makes the methods of the
> class appear in the same order as in the code:
> 
> from sphinx.ext import autodoc
> from sphinx.ext.autodoc import ClassDocumenter
> 
> class MyClassDocumenter(ClassDocumenter):
> 
>     def get_object_members(self, want_all):
>         members_check_module, members = super(MyClassDocumenter,
> self).get_object_members(want_all)
>         def key((name, obj)):
>             try:
>                 return obj.im_func.func_code.co_firstlineno
>             except AttributeError:
>                 return 0
>         members.sort(key=key)
>         return members_check_module, members
> 
> autodoc.ClassDocumenter = MyClassDocumenter
> 
> This may not work in your case. In particular, it won't work if you
> set autodoc_member_order to 'groupwise'.
> 
> Would be nice if sphinx had an option to do this without hacking.

It's a nice hack.  It doesn't work with inherited methods, though,
it'll have to be grouped by co_filename somehow (but finding out
which one to place first is tricky).

Georg
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.11 (GNU/Linux)

iEYEARECAAYFAkr3GpkACgkQN9GcIYhpnLDSIgCeJcj+Hz5CjVMuB0YR7LUtHul3
uiIAnjxFUS+waDE8RuAW0x1PohxBVrC0
=J/Ha
-----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