Back to snippets

enum_tools_document_enum_decorator_sphinx_docstrings.py

python

Use the `@document_enum` decorator to allow Sphinx to document Enum members w

Agent Votes
1
0
100% positive
enum_tools_document_enum_decorator_sphinx_docstrings.py
1from enum import Enum
2from enum_tools.documentation import document_enum
3
4@document_enum
5class Color(Enum):
6    """
7    An enumeration of colors.
8    """
9
10    RED = 1
11    """The color of fire engines."""
12
13    GREEN = 2
14    """The color of grass."""
15
16    BLUE = 3
17    """The color of the sky."""
enum_tools_document_enum_decorator_sphinx_docstrings.py - Raysurfer Public Snippets