-
Notifications
You must be signed in to change notification settings - Fork 2
refactor!: Remove custom Enums
#136
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
|
Thanks for opening this pull request! This pull request can be checked-out with: git fetch origin pull/136/head:pr-136
git checkout pr-136This pull request can be installed with: pip install git+https://github.com/Pycord-Development/pycord-next@refs/pull/136/head |
Documentation build overview
Show files changed (6 files in total): 📝 6 modified | ➕ 0 added | ➖ 0 deleted
|
|
This seems nice overall,but why don't I have the button to merge master in here ? Also please update the CHANEGLOG-V3.md |
|
@DA-344 DO you have the button to "Update Branch" |
|
uhh no, just Merge lol |
|
Ooh it's because your base branch is pycord not Pycord-next |
|
wharever |
Lumabots
left a comment
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.
see pr
|
@DA-344 Did you test this one ? I will trust your good faith |
|
Yeah it's tested, repro code (using VerificationLevel enum as an example): class VerificationLevel(Enum, comparable=True):
none = 0
low = 1
medium = 2
high = 3
highest = 4
print(VerificationLevel.low)
unknown = VerificationLevel(10)
print(unknown)
print(VerificationLevel.low < unknown)
print(VerificationLevel(10) is unknown)
print(VerificationLevel.low < VerificationLevel.high)
print(VerificationLevel.low > VerificationLevel.high)output: VerificationLevel.low
VerificationLevel.unknown_10
True
True
True
False |
|
Here goes nothing |
Co-authored-by: DA-344 <[email protected]> Co-authored-by: Paillat <[email protected]>
Summary
This uses the
_missing_classmethod provided by the stdlib to handle unknown values in enums. This is essentially the reason why the customEnumwas made.This may also solve many problems caused by the custom Enum class (such as the annoying type warnings of Pylance).
Information
examples, ...).
Checklist
type: ignorecomments were used, a comment is also left explaining why.