-
-
Notifications
You must be signed in to change notification settings - Fork 471
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
feat: handle typing.Annotated form annotations in slash commands option parser. #2124
feat: handle typing.Annotated form annotations in slash commands option parser. #2124
Conversation
* Adds function for checking if a parameter is annotated by form typing.Annotated. * Adds conditional block to parse parameter annotation if that check is true.
I'm not sure how/ where to update documentation, but I can try if given advice. |
Ah, didn't see Pycord targets minimum python version 3.8. These changes support/ require 3.9 changes. |
You should import |
…ated' into handle-typing-annotated
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## master #2124 +/- ##
==========================================
+ Coverage 33.11% 33.87% +0.76%
==========================================
Files 97 109 +12
Lines 19151 22340 +3189
==========================================
+ Hits 6342 7568 +1226
- Misses 12809 14772 +1963
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 22 files with indirect coverage changes Continue to review full report in Codecov by Sentry.
|
Pycord requires typing_extensions as a dependency for python < 3.11, however not on version >= 3.11. Because the changes in the referenced pull always tries to load from typing_extensions, they make it so an exception will be raised if the end user is using python >= 3.11 and does not otherwise have that library install, an exception will occur when _parse_options is run (ie, whenever a command is registered.) This change checks the version of python running Pycord, then imports stdlib typing if >= 3.11.
Pycord requires typing_extensions as a dependency for python < 3.11, however not on version >= 3.11. Because the changes in the referenced pull always tries to load from typing_extensions, they make it so an exception will be raised if the end user is using python >= 3.11 and does not otherwise have that library installed when _parse_options is run (ie, whenever a command is registered). This change checks the version of python running Pycord, then imports stdlib typing if >= 3.11.
Pycord requires typing_extensions as a dependency for python < 3.11, however not on version >= 3.11. Because the changes in the referenced pull always tries to load from typing_extensions, they make it so an exception will be raised if the end user is using python >= 3.11 and does not otherwise have that library installed when _parse_options is run (ie, whenever a command is registered). This change checks the version of python running Pycord, then imports stdlib typing if >= 3.11.
Summary
Resolves #2120. These changes allow options definitions of the form:
Information
examples, ...).
Checklist
type: ignore
comments were used, a comment is also left explaining why.