-
Notifications
You must be signed in to change notification settings - Fork 2
Add Enum class that supports deprecated members
#88
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Signed-off-by: Leandro Lucarella <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR introduces a new frequenz.core.enum module that provides an enhanced Enum class supporting deprecated enum members. The implementation extends the standard library's enum functionality to emit deprecation warnings when deprecated members are accessed.
Key changes:
- Added
DeprecatedMemberclass for marking deprecated enum members - Implemented
DeprecatingEnumMetametaclass to handle deprecation logic - Created comprehensive test suite covering attribute access, name lookup, and value lookup scenarios
Reviewed Changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/frequenz/core/enum.py | Main implementation of the enhanced Enum class with deprecation support |
| tests/test_enum.py | Comprehensive test suite covering all deprecation warning scenarios |
| src/frequenz/core/datetime.py | Minor docstring update to improve module description |
| RELEASE_NOTES.md | Documentation of the new enum module feature |
| README.md | Added usage example for the new enum functionality |
| .github/labeler.yml | Added part:enum label configuration |
| .github/keylabeler.yml | Added enum part to key label mappings |
| .github/ISSUE_TEMPLATE/bug.yml | Added enum utilities to bug template options |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Signed-off-by: Leandro Lucarella <[email protected]>
Co-authored-by: Copilot <[email protected]> Signed-off-by: Leandro Lucarella <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
|
I added a new fixup commit to replace |
This commit introduces a new `frequenz.core.enum` module that provides a drop-in replacement for the standard library's `enum.Enum` class, with added support for deprecating enum members. Signed-off-by: Leandro Lucarella <[email protected]>
Signed-off-by: Leandro Lucarella <[email protected]>
Signed-off-by: Leandro Lucarella <[email protected]>
|
And now that I see it was approved, I squashed all fixup commits, so this is ready for a final approval. |
This commit introduces a new
frequenz.core.enummodule that provides a drop-in replacement for the standard library'senum.Enumclass, with added support for deprecating enum members.