-
Notifications
You must be signed in to change notification settings - Fork 135
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
Pycharm cannot determine type when using @utils.cached_slot_property
#1146
Comments
I doubt there's anything we can do about this, unfortunately. PyCharm has been struggling to infer descriptor types (especially generic ones) correctly for a long time, and ultimately it's up to them to fix it - disnake isn't the only library affected by this.
Mypy and Pyright can handle these just fine, so those might be your best bet for now. |
Thanks! One of the possible solutions in PyCharm: @commands.slash_command()
async def ping(self, inter: disnake.CommandInteraction) -> None:
assert isinstance(inter.response, disnake.InteractionResponse)
await inter.response.send_message("Pong!") Or @commands.slash_command()
async def ping(self, inter: disnake.CommandInteraction) -> None:
inter.response: disnake.InteractionResponse # type: ignore
await inter.response.send_message("Pong!") |
This should probably be closed? |
Summary
Pycharm does not recognize type, which is why the method hints are not displayed
Reproduction Steps
Write code:
Minimal Reproducible Code
No response
Expected Results
Type-based hints
Actual Results
Lack of hints
Intents
Intents.default()
System Information
Checklist
Additional Context
Pycharm
bug report: https://youtrack.jetbrains.com/issue/PY-63737/PyCharm-fails-to-infer-generic-descriptor-type-when-descriptor-is-used-as-a-decoratorPylance
works correctly (VSCode
)The text was updated successfully, but these errors were encountered: