Closed
Conversation
ba45351 to
31089b1
Compare
There was a problem hiding this comment.
Pull Request Overview
This pull request adds a basedpyright CI job with a “baseline” configuration and modernizes type annotations across the codebase by replacing Union[...] with the new | syntax, plus a couple of strict-parameter adjustments in zip calls.
- Introduce
basedpyrightrun in GitHub Actions for gradual typing - Replace
typing.Unionannotations with PEP 604-style unions (A | B) - Add explicit
strict=Falsetozipin two methods (though default is alreadyFalse) - Update changelog to note removal of Python 3.9 support
Reviewed Changes
Copilot reviewed 38 out of 38 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| discord/state.py | Updated Channel union syntax; added strict=False to zip in _delay_ready |
| discord/role.py | Added strict=False to zip in _move payload comprehension |
| discord/object.py | Updated SupportsIntCast alias to PEP 604 union syntax |
| discord/message.py | Modernized EmojiInputType to use ` |
| discord/member.py | Replaced VocalGuildChannel Union with ` |
| discord/iterators.py | Replaced internal _Func return union with ` |
| discord/invite.py | Swapped out Union[...] for TypeAlias-style unions |
| discord/interactions.py | Modernized InteractionChannel union syntax |
| discord/guild.py | Converted channel-type aliases to PEP 604 unions |
| discord/ext/commands/flags.py | Adjusted optional flag handling; removed import of Union |
| discord/ext/commands/context.py | Updated BotT bound to `Bot |
| discord/ext/commands/_types.py | Converted many Union-based definitions to ` |
| discord/ext/bridge/context.py | Simplified Context union to ` |
| discord/errors.py | Replaced _ResponseType union with PEP 604 syntax |
| discord/commands/options.py | Refactored InputType to new union grouping syntax |
| discord/commands/core.py | Marked deprecated Union[...] usage with TODO and noqa |
| discord/activity.py | Updated ActivityTypes to use PEP 604 unions |
| discord/abc.py | Cleaned up MessageableChannel and SnowflakeTime aliases |
| CHANGELOG-V3.md | Noted removal of Python 3.9 support |
| .github/workflows/lib-checks.yml | Added basedpyright job to CI workflow |
Comments suppressed due to low confidence (1)
discord/ext/commands/flags.py:421
- You removed the
Unionimport at the top but still referenceUnionhere, which will cause aNameError. Re-importUnionor replace this with the modern|syntax.
annotation = Union[annotation.__args__[:-1]] # noqa: UP007
Member
Author
|
since ty is in beta used that instead |
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.
In an effort to have better typing, this sets up basedpyright with the "baseline" feature, which will ignore all typing errors from before this pull request and allow for gradual typing of code. Idk if this is the best, but I figured I might as well try. This needs #4 to be merged first.