Type-check the 'autodoc_intenum' example (#12827)

This commit is contained in:
danieleades
2024-10-12 01:14:56 +01:00
committed by GitHub
parent 86d1d31fb3
commit 05679efe7b
2 changed files with 4 additions and 3 deletions

View File

@@ -35,16 +35,15 @@ class IntEnumDocumenter(ClassDocumenter):
def add_content(
self,
more_content: StringList | None,
no_docstring: bool = False,
) -> None:
super().add_content(more_content, no_docstring)
super().add_content(more_content)
source_name = self.get_sourcename()
enum_object: IntEnum = self.object
use_hex = self.options.hex
self.add_line('', source_name)
for the_member_name, enum_member in enum_object.__members__.items():
for the_member_name, enum_member in enum_object.__members__.items(): # type: ignore[attr-defined]
the_member_value = enum_member.value
if use_hex:
the_member_value = hex(the_member_value)

View File

@@ -140,6 +140,8 @@ exclude = [
[tool.mypy]
files = [
"doc/conf.py",
"doc/development/tutorials/examples/autodoc_intenum.py",
"doc/development/tutorials/examples/helloworld.py",
"sphinx",
"tests",
"utils",