FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Phase 2 of async/await by gvanrossum · Pull Request #1946 · python/mypy · GitHub

Repository navigation

Phase 2 of async/await - #1946

Merged
ddfisher merged 23 commits into
masterfrom
add-crawl2-reborn
Aug 3, 2016
Merged

ddfisher merged 23 commits into
masterfrom
add-crawl2-reborn

Conversation

Copy link
Copy Markdown
Member

This PR adds support for decorating either generators or async def functions with @types.coroutine or @asyncio.coroutine. This will fix #1453.

@abstractmethod
def __await__(self) -> Generator[Any, Any, T]: pass

class AwaitableGenerator(Generator[T, U, V], Awaitable[V], Generic[T, U, V, S]):

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Why is there an AwaitableGenerator in the test data typing stub when there isn't one in the real typing module?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Because this stub (despite its extension) is actually a stub. It matches the real typing.pyi, not any real typing.py.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Oh okay. That makes sense.

Comment thread mypy/checker.py Outdated
self.lookup_qualified('typing.AwaitableGenerator')
except KeyError:
return False
agt = self.named_generic_type('typing.AwaitableGenerator',

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Wouldn't it be simpler to just look at the fullname instead, like we do elsewhere?

Comment thread mypy/checker.py Outdated
else:
# `return_type` is a supertype of Generator, so callers won't be able to send it
# values.
# Supertype of Generator (Iterator, Iterable, object), tc is None.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

I think the bit of motivation is worthwhile here too.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

ddfisher merged commit 340d34e into master Aug 3, 2016
ddfisher deleted the add-crawl2-reborn branch August 3, 2016 23:57

ddfisher commented Aug 3, 2016

Copy link
Copy Markdown
Collaborator

🎉

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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.

Support PEP 492 syntax

2 participants


Back | FazBrowse Home | New Git URL