Draft: Use StrEnum and unique for chroottype
- chroottype: enforce unique enum and strenum
Merge request reports
Activity
In python 3.11, StrEnums were introduced. I want to use StrEnums as they are just more concise and you dont need to call .value everywhere or define str. Since 3.10 doesnt support StrEnum, you can make the equivalent of StrEnum by inheriting from str and Enum. However, there is this issue with the str and Enum inherit:
https://github.com/python/cpython/issues/100458
Your call, I wanted to open this MR to see what you thought would be the best approach. All that said, I do think we should always use the
@unique
decorator on this and other enums which are unique. It makes scanning the enum and understanding the == operator for that enum easier.I had to add a
__str__
overload in mrhlpr because it wasn't using the actual value of the enum but rather the name of it for the string representation even though it inherited from str: mrhlpr@d49a1ccfIs this different somehow?
added 69 commits
-
1df4dce5...a8283033 - 68 commits from branch
postmarketOS:master
- 883d3e3c - chroottype: enforce unique enum and strenum
-
1df4dce5...a8283033 - 68 commits from branch
Marking as draft to get this out of the review queue as !2486 (comment 457065) hasn't been answered.