Skip to content
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

Fix mypy configuration by ignoring two files, to satisfy CI #1710

Closed
wants to merge 1 commit into from

Conversation

amotl
Copy link
Contributor

@amotl amotl commented Jan 17, 2023

Hi again,

at GH-1709, we discovered that the test suite on CI currently croaks from an error with mypy. mypy raised this error on four occasions (see below):

error: "_SupportsAcloseT" has no attribute "__aiter__" (not async iterable)  [attr-defined]

This patch aims to silence this error by ignoring the corresponding files, in order to satisfy CI. Let us know if you think this should be made happen differently.

With kind regards,
Andreas.


The root cause are those errors, where both python/mypy#10301 and python/mypy#5385 (comment) have interesting information, with a specific suggestion by @JelleZijlstra:

I think you shouldn't make the protocol function async def, but just def. Conceptually, an async generator is a callable that returns an AsyncIterator (or more precisely, an AsyncGenerator). But an async def function without a yield returns an Awaitable of whatever its declared return type is, so that's how mypy interprets your protocol.

$ mypy --strict src/prompt_toolkit --platform win32
src/prompt_toolkit/completion/base.py:284: error: "_SupportsAcloseT" has no attribute "__aiter__" (not async iterable)  [attr-defined]
src/prompt_toolkit/completion/base.py:367: error: "_SupportsAcloseT" has no attribute "__aiter__" (not async iterable)  [attr-defined]
src/prompt_toolkit/completion/base.py:395: error: "_SupportsAcloseT" has no attribute "__aiter__" (not async iterable)  [attr-defined]
src/prompt_toolkit/buffer.py:1763: error: "_SupportsAcloseT" has no attribute "__aiter__" (not async iterable)  [attr-defined]

mypy raised this error on four occasions:

  error: "_SupportsAcloseT" has no attribute "__aiter__" (not async
  iterable)  [attr-defined]
@amotl amotl marked this pull request as ready for review January 17, 2023 16:35
@jonathanslenders
Copy link
Member

Hi @amotl! Thanks for pointing out the issue.

I just had a look. No need to ignore anything.
This should fix it instead: #1711

@amotl amotl deleted the amo/fix-mypy branch January 17, 2023 20:31
@amotl
Copy link
Contributor Author

amotl commented Jan 17, 2023

Lovely. Thanks for fixing it in a correct way so quickly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants