summaryrefslogtreecommitdiff
path: root/doc/development/tutorials/examples/autodoc_intenum.py
diff options
context:
space:
mode:
authorJouke Witteveen <j.witteveen@gmail.com>2021-12-06 12:31:09 +0100
committerGitHub <noreply@github.com>2021-12-06 12:31:09 +0100
commite200e7b7c122be696685722a119a0a2764b35052 (patch)
tree4a48b72c7237f8c21a9c7f965f6a6faaae983fdd /doc/development/tutorials/examples/autodoc_intenum.py
parentedd14783f3cc6222066fd63efbe28c2728617e18 (diff)
downloadsphinx-git-e200e7b7c122be696685722a119a0a2764b35052.tar.gz
doc: Improve autodoc extension example
Enumerations can have aliases, which should be documented as well.
Diffstat (limited to 'doc/development/tutorials/examples/autodoc_intenum.py')
-rw-r--r--doc/development/tutorials/examples/autodoc_intenum.py9
1 files changed, 4 insertions, 5 deletions
diff --git a/doc/development/tutorials/examples/autodoc_intenum.py b/doc/development/tutorials/examples/autodoc_intenum.py
index 574ac3621..a23f9cebf 100644
--- a/doc/development/tutorials/examples/autodoc_intenum.py
+++ b/doc/development/tutorials/examples/autodoc_intenum.py
@@ -39,14 +39,13 @@ class IntEnumDocumenter(ClassDocumenter):
use_hex = self.options.hex
self.add_line('', source_name)
- for enum_value in enum_object:
- the_value_name = enum_value.name
- the_value_value = enum_value.value
+ for the_member_name, enum_member in enum_object.__members__.items():
+ the_member_value = enum_member.value
if use_hex:
- the_value_value = hex(the_value_value)
+ the_member_value = hex(the_member_value)
self.add_line(
- f"**{the_value_name}**: {the_value_value}", source_name)
+ f"**{the_member_name}**: {the_member_value}", source_name)
self.add_line('', source_name)