Skip to content

Remove typing.AwaitableGenerator from typeshed #8699

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

Closed
hauntsaninja opened this issue Apr 21, 2020 · 6 comments
Closed

Remove typing.AwaitableGenerator from typeshed #8699

hauntsaninja opened this issue Apr 21, 2020 · 6 comments
Labels
affects-typeshed Anything that blocks a typeshed change topic-async async, await, asyncio

Comments

@hauntsaninja
Copy link
Collaborator

As mentioned in the code, AwaitableGenerator doesn't exist in typing.py or PEP 484.
https://github.com/python/typeshed/blob/626a0f3f7353e484e8a6c5d7a2b3f37e4694e132/stdlib/3/typing.pyi#L208

It appears it's an "intentionally undocumented" implementation detail of mypy, as mentioned in #2907. Ideally, these shouldn't leak into typeshed.

@msullivan
Copy link
Collaborator

We could make it underscored or (and?) move it into mypy_extensions. Probably it still needs to live in typeshed somewhere because at least as it stands now we don't have anywhere else to put class definitions that mypy uses internally...

@hauntsaninja
Copy link
Collaborator Author

hauntsaninja commented Apr 29, 2020

Moving it to mypy_extensions makes sense. I guess we don't actually need to change mypy_extensions, just typeshed's third_party/2and3/mypy_extensions.pyi? Which seems fine to me...

I'd like to make it underscored (wherever it lives, but particularly if it remains in typing.pyi), since it's implementation detail. But based on check-async-await.test it seems to make its way into error messages, so maybe the underscore is undesirable?

Happy to submit a PR for the following:

  1. In typeshed, remove it from typing.pyi, and add it to mypy_extensions.pyi
  2. In mypy, s/typing.AwaitableGenerator/mypy_extensions._AwaitableGenerator/g
  3. Update typeshed submodule

This also doesn't really matter, so if it's not as straightforward as that, happy to back-burner this.

@srittau
Copy link
Contributor

srittau commented Apr 30, 2020

@hauntsaninja +1 from me and I would also prefer not having mypy-specific types in typing.pyi, but I'll leave the decision about this to the mypy maintainers.

@graingert
Copy link
Contributor

I suspect twisted.internet.defer.Deferred should be an AwaitableGenerator, how can I use this type?

@AlexWaygood AlexWaygood added topic-async async, await, asyncio affects-typeshed Anything that blocks a typeshed change labels Mar 31, 2022
@AlexWaygood
Copy link
Member

Closing in favour of #8240 (cc. @JelleZijlstra)

@AlanBogarin
Copy link

I suspect twisted.internet.defer.Deferred should be an AwaitableGenerator, how can I use this type?

Is an Iterable & Awaitable

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affects-typeshed Anything that blocks a typeshed change topic-async async, await, asyncio
Projects
None yet
Development

No branches or pull requests

6 participants