Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions src/frequenz/core/enum.py
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,7 @@ class Enum(enum.Enum): # noqa
else:

class Enum(enum.Enum, metaclass=DeprecatingEnumType):
"""Base class for enums that support deprecated members.
'''Base class for enums that support deprecated members.

This class extends the standard library's [`enum.Enum`][] to support marking
certain members as deprecated. Deprecated members can be accessed, but doing so
Expand All @@ -412,8 +412,12 @@ class TaskStatus(Enum):
4,
"mypkg.TaskStatus.CANCELLED is deprecated. "
"Cancelled tasks are deleted now.",
since="v1.3.0",
)
"""The task was cancelled.

Deprecated:
Deprecated since v1.3.0. Cancelled tasks are deleted now.
"""

# Accessing deprecated members by name warns:
status1 = TaskStatus.PENDING
Expand Down Expand Up @@ -442,8 +446,9 @@ class TaskStatus(Enum):
`CANCELLED` has no member to point at, so it gives its own `message`,
starting with its fully qualified name. That replaces the warning
only, so its notice is written by hand, as a `Deprecated:` admonition
in the member's docstring.
"""
in the member's docstring. That notice says the version too, so
`since` is not needed.
'''

__deprecated_names__: ClassVar[Mapping[str, str]]
__deprecated_value_map__: ClassVar[Mapping[Self, str]]
Expand Down