Skip to content

Conversation

DA-344
Copy link

@DA-344 DA-344 commented Oct 3, 2025

Summary

This uses the _missing_ classmethod provided by the stdlib to handle unknown values in enums. This is essentially the reason why the custom Enum was made.

This may also solve many problems caused by the custom Enum class (such as the annoying type warnings of Pylance).

Information

  • This PR fixes an issue.
  • This PR adds something new (e.g. new method or parameters).
  • This PR is a breaking change (e.g. methods or parameters removed/renamed).
  • This PR is not a code change (e.g. documentation, README, typehinting,
    examples, ...).

Checklist

  • I have searched the open pull requests for duplicates.
  • If code changes were made then they have been tested.
    • I have updated the documentation to reflect the changes.
  • If type: ignore comments were used, a comment is also left explaining why.
  • I have updated the changelog to include these changes.

@DA-344 DA-344 requested a review from a team as a code owner October 3, 2025 20:58
@pycord-app
Copy link

pycord-app bot commented Oct 3, 2025

Thanks for opening this pull request!
Please make sure you have read the Contributing Guidelines and Code of Conduct.

This pull request can be checked-out with:

git fetch origin pull/136/head:pr-136
git checkout pr-136

This pull request can be installed with:

pip install git+https://github.com/Pycord-Development/pycord-next@refs/pull/136/head

Copy link

read-the-docs-community bot commented Oct 3, 2025

Documentation build overview

📚 pycord-next | 🛠️ Build #29837360 | 📁 Comparing 4527ccd against latest (1509fba)


🔍 Preview build

Show files changed (6 files in total): 📝 6 modified | ➕ 0 added | ➖ 0 deleted
File Status
api/data_classes.html 📝 modified
api/models.html 📝 modified
api/ui_kit.html 📝 modified
_modules/discord/enums.html 📝 modified
ext/commands/api.html 📝 modified
ext/pages/index.html 📝 modified

@Paillat-dev
Copy link
Member

This seems nice overall,but why don't I have the button to merge master in here ? Also please update the CHANEGLOG-V3.md

@Paillat-dev
Copy link
Member

@DA-344 DO you have the button to "Update Branch"

@DA-344
Copy link
Author

DA-344 commented Oct 4, 2025

uhh no, just Merge lol

@Paillat-dev
Copy link
Member

Ooh it's because your base branch is pycord not Pycord-next

@Paillat-dev
Copy link
Member

wharever

@Paillat-dev Paillat-dev linked an issue Oct 4, 2025 that may be closed by this pull request
Copy link

@Lumabots Lumabots left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see pr

@Lumabots
Copy link

Lumabots commented Oct 6, 2025

#140

@Paillat-dev Paillat-dev mentioned this pull request Oct 6, 2025
9 tasks
@Paillat-dev
Copy link
Member

Paillat-dev commented Oct 6, 2025

@DA-344 Did you test this one ? I will trust your good faith

@DA-344
Copy link
Author

DA-344 commented Oct 6, 2025

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

@Paillat-dev
Copy link
Member

Here goes nothing

@Paillat-dev Paillat-dev merged commit 38caf31 into Pycord-Development:master Oct 6, 2025
10 of 11 checks passed
Paillat-dev added a commit that referenced this pull request Oct 6, 2025
Co-authored-by: DA-344 <108473820+DA-344@users.noreply.github.com>
Co-authored-by: Paillat <paillat@pycord.dev>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Evaulate the custom Enum class
3 participants