bryanforbes / discord-ext-typed-commands

BSD 3-Clause "New" or "Revised" License
1 stars 1 forks source link

Pylint produces unsubscriptable-object error with typed classes #21

Open linuxdaemon opened 3 years ago

linuxdaemon commented 3 years ago

Minimal Code

from discord.ext import typed_commands
from discord.ext.typed_commands import Bot, Cog, Context

class MyCog(Cog[Context]):
    def __init__(self, bot: Bot[Context]) -> None:
        self.bot = bot

    @typed_commands.command(name="foo")
    async def cmd_foo(self, ctx: Context) -> None:
        await ctx.send("bar")

def setup(bot: Bot[Context]) -> None:
    bot.add_cog(MyCog(bot))

Run pylint against this code with default configs. This code passes mypy --strict but fails pylint.

Versions

mypy==0.790 pylint==2.6.0 discord-ext-typed-commands==1.0.2 discord.py==1.5.0 discord.py-stubs==1.5.0.1

bryanforbes commented 3 years ago

What error is raised by pylint? I see now that it's in the title. I believe this is an issue with pylint and not this library.

linuxdaemon commented 3 years ago

This issue occurs with PyCharm's inspections as well, it seems to be something with the typing information in the .py vs the .pyi stubs? I'm not sure