diff options
author | Campbell Barton <ideasman42@gmail.com> | 2010-08-11 21:13:39 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2010-08-11 21:13:39 +0400 |
commit | 6cae52bca28bd130e1ceca0e982dbe271e2ea578 (patch) | |
tree | 61fbdfc9932a49a1cdfec9c8d033b97d7da89f37 /source/blender/python | |
parent | 556b615cf8eae8c656f2d2a0905564e5c0de98cc (diff) |
add support for documenting class methods
Diffstat (limited to 'source/blender/python')
-rw-r--r-- | source/blender/python/doc/sphinx_doc_gen.py | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/source/blender/python/doc/sphinx_doc_gen.py b/source/blender/python/doc/sphinx_doc_gen.py index 875efd75246..492f66e3295 100644 --- a/source/blender/python/doc/sphinx_doc_gen.py +++ b/source/blender/python/doc/sphinx_doc_gen.py @@ -45,6 +45,7 @@ import rna_info reload(rna_info) # lame, python wont give some access +ClassMethodDescriptorType = type(dict.__dict__['fromkeys']) MethodDescriptorType = type(dict.get) GetSetDescriptorType = type(int.real) @@ -151,10 +152,10 @@ def py_descr2sphinx(ident, fw, descr, module_name, type_name, identifier): if type(descr) == GetSetDescriptorType: fw(ident + ".. attribute:: %s\n\n" % identifier) write_indented_lines(ident + " ", fw, doc, False) - elif type(descr) == MethodDescriptorType: # GetSetDescriptorType's are not documented yet + elif type(descr) in (MethodDescriptorType, ClassMethodDescriptorType): write_indented_lines(ident, fw, doc, False) else: - raise TypeError("type was not GetSetDescriptorType or MethodDescriptorType") + raise TypeError("type was not GetSetDescriptorType, MethodDescriptorType or ClassMethodDescriptorType") write_example_ref(ident, fw, module_name + "." + type_name + "." + identifier) fw("\n") @@ -268,6 +269,10 @@ def pymodule2sphinx(BASEPATH, module_name, module, title): descr_items = [(key, descr) for key, descr in sorted(value.__dict__.items()) if not key.startswith("__")] for key, descr in descr_items: + if type(descr) == ClassMethodDescriptorType: # GetSetDescriptorType's are not documented yet + py_descr2sphinx(" ", fw, descr, module_name, type_name, key) + + for key, descr in descr_items: if type(descr) == MethodDescriptorType: # GetSetDescriptorType's are not documented yet py_descr2sphinx(" ", fw, descr, module_name, type_name, key) |