chore: remove superfluous constants#1136
Merged
jpadilla merged 2 commits intojpadilla:masterfrom Feb 18, 2026
Merged
Conversation
d40a1a1 to
8ad28cf
Compare
Contributor
Author
|
@jpadilla the coverage change here doesn't seem meaningful - please have a look. Thanks! |
This Py >= 3.10 TODO is doable even on 3.9, so do it.
8ad28cf to
7cbe990
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
This PR refactors the JWT algorithms module to remove superfluous constant tuples that were previously used for runtime type checking. The changes leverage Python's typing.get_args() to dynamically extract type information from Union type aliases at runtime, replacing the need for separate constant tuples.
Changes:
- Removed constant tuples (
ALLOWED_RSA_KEY_TYPES,ALLOWED_EC_KEY_TYPES,ALLOWED_OKP_KEY_TYPES, etc.) and replaced them withget_args()calls on Union types - Moved TypeAlias definitions outside of
TYPE_CHECKINGblock to make them available at runtime - Added type casts where necessary to satisfy type checkers after isinstance checks
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| jwt/algorithms.py | Refactored to use get_args() for extracting types from Union type aliases, replacing constant tuples; moved TypeAlias definitions outside TYPE_CHECKING block |
| .github/workflows/main.yml | Added comments and explicit file specification for codecov uploads |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
a6784e8 to
7cbe990
Compare
Scope mypy missing-import suppression to cryptography only, and make no-crypto key aliases explicit with Never.
8ed9560 to
6f3b616
Compare
jpadilla
approved these changes
Feb 18, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This Py >= 3.10 TODO is doable even on 3.9, so do it.