jhnnsrs / rath

rath is an apollo-like graphql client that supports links, multipart uploads, websocket subscriptions with sync and async interface
https://jhnnsrs.github.io/rath/
MIT License
9 stars 3 forks source link

Async context reports unawaited in pycharm #15

Open Evgenus opened 2 years ago

Evgenus commented 2 years ago

I found a strange warning in pycharm.

зображення

Maybe that is their problem. Maybe it is because of koil. Maybe because rath is a context and async context at the same time. It works well in runtime.

jhnnsrs commented 2 years ago

hm that indeed seems to be a bit strange, in vscode i don't experience any of this. I would think that its maybe due to the fact that async def aenter is typed with TypeVars on the KoiledModel (iwas trying to get around using only the >3.10 compatible "Self" type).

Could you see if that error persists if you change rath to


from typing_extensions import Self

class Rath(KoiledModel):
    ....

    async def __aenter__(self) -> Self:
        self._entered = True
        if self.context:
            self.context.set(self)
        await self.link.__aenter__()
        return self