diff options
author | Takeshi KOMIYA <i.tkomiya@gmail.com> | 2021-12-04 11:08:46 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-12-04 11:08:46 +0900 |
commit | 4d176d4564b6d0fb6163647f0e246b06af904378 (patch) | |
tree | 1b6c5e8ea734533e6a7dc6def42937fdf62b7adf /doc/development/tutorials/examples/autodoc_intenum.py | |
parent | 17dfa811078205bd415700361e97e945112b89eb (diff) | |
parent | bc849e2170db3fa09dd498e4737a056c0fbfceaa (diff) | |
download | sphinx-git-4d176d4564b6d0fb6163647f0e246b06af904378.tar.gz |
Merge pull request #9928 from joukewitteveen/patch-1
doc: Fix autodoc extension example
Diffstat (limited to 'doc/development/tutorials/examples/autodoc_intenum.py')
-rw-r--r-- | doc/development/tutorials/examples/autodoc_intenum.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/doc/development/tutorials/examples/autodoc_intenum.py b/doc/development/tutorials/examples/autodoc_intenum.py index 7fb85d066..574ac3621 100644 --- a/doc/development/tutorials/examples/autodoc_intenum.py +++ b/doc/development/tutorials/examples/autodoc_intenum.py @@ -9,7 +9,7 @@ from sphinx.ext.autodoc import ClassDocumenter, bool_option class IntEnumDocumenter(ClassDocumenter): objtype = 'intenum' - directivetype = 'class' + directivetype = ClassDocumenter.objtype priority = 10 + ClassDocumenter.priority option_spec = dict(ClassDocumenter.option_spec) option_spec['hex'] = bool_option @@ -18,7 +18,10 @@ class IntEnumDocumenter(ClassDocumenter): def can_document_member(cls, member: Any, membername: str, isattr: bool, parent: Any) -> bool: - return isinstance(member, IntEnum) + try: + return issubclass(member, IntEnum) + except TypeError: + return False def add_directive_header(self, sig: str) -> None: super().add_directive_header(sig) |