Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Pyright reports false positive error with
asynccontextmanager
(#87)
Pyright gets confused and will give you error messages like this: ``` error: Object of type "AsyncIterator[AsyncGenerator[...]]" cannot be used with "with" because it does not implement __aenter__ (reportGeneralTypeIssues) error: Object of type "AsyncIterator[AsyncGenerator[...]]" cannot be used with "with" because it does not implement __aexit__ (reportGeneralTypeIssues) ``` For code like this: ```python async with Client("test.mosquitto.org") as client: async with client.filtered_messages("floors/+/humidity") as messages: await client.subscribe("floors/#") async for message in messages: print(message.payload.decode()) ``` This change statically checks against `sys.version_info` for the right version, which Pyright understands.
- Loading branch information