-
-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix import to appease mypy's import resolution
- Loading branch information
1 parent
ce06bee
commit e196167
Showing
1 changed file
with
2 additions
and
2 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -69,7 +69,7 @@ | |
# Generally, these two libraries are supposed to be separate from each other. | ||
# However, for type hinting purposes it's unfortunately necessary for one to | ||
# reference the other to prevent type checking errors in callbacks | ||
from discord.ext.commands import Cog | ||
from discord.ext import commands | ||
This comment has been minimized.
Sorry, something went wrong. |
||
|
||
ErrorFunc = Callable[[Interaction, AppCommandError], Coroutine[Any, Any, None]] | ||
|
||
|
@@ -105,7 +105,7 @@ | |
UnboundError, | ||
] | ||
Check = Callable[['Interaction'], Union[bool, Coro[bool]]] | ||
Binding = Union['Group', 'Cog'] | ||
Binding = Union['Group', 'commands.Cog'] | ||
This comment has been minimized.
Sorry, something went wrong.
richfromm
|
||
|
||
|
||
if TYPE_CHECKING: | ||
|
This is not yet released, correct? It's not in 2.0.1 but will go in whatever is next, presumably 2.1 (but I suppose could be 2.0.2)
I've been having a bizarre situation where my use of mypy on a repo using discord.py as a library alternates between failing with the following:
and passing (that is, just re-running mypy without making any changes.
Fwiw, I was also able to fix this with the following local change:
I don't know enough about the underlying issue to say which solution is "better" (or if there may be other consequences to my change, I didn't try running any unit tests, or actually using the commands in the library, with this change).
For context, see:
bryanforbes/discord.py-stubs#171 (comment)
bryanforbes/discord.py-stubs#171 (comment)