| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| @abstractmethod | ||
| def __await__(self) -> Generator[Any, Any, T]: pass | ||
|
|
||
| class AwaitableGenerator(Generator[T, U, V], Awaitable[V], Generic[T, U, V, S]): |
There was a problem hiding this comment.
Why is there an AwaitableGenerator in the test data typing stub when there isn't one in the real typing module?
Sorry, something went wrong.
There was a problem hiding this comment.
Because this stub (despite its extension) is actually a stub. It matches the real typing.pyi, not any real typing.py.
Sorry, something went wrong.
There was a problem hiding this comment.
Oh okay. That makes sense.
Sorry, something went wrong.
| self.lookup_qualified('typing.AwaitableGenerator') | ||
| except KeyError: | ||
| return False | ||
| agt = self.named_generic_type('typing.AwaitableGenerator', |
There was a problem hiding this comment.
Wouldn't it be simpler to just look at the fullname instead, like we do elsewhere?
Sorry, something went wrong.
Both crawl.py and crawl2.py pass cleanly now!
| 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. |
There was a problem hiding this comment.
I think the bit of motivation is worthwhile here too.
Sorry, something went wrong.
There was a problem hiding this comment.
Sorry, something went wrong.
Mostly streamlined the comments, but also decided that return in a generator not explicitly declared as returning Any or Generator should be None.
NOTE: the Matrix test is currently failing.
Upgrade AwaitableGenerator to four parameters -- the last one preserves the original type, which we sometimes need.
|
🎉 |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
This PR adds support for decorating either generators or async def functions with @types.coroutine or @asyncio.coroutine. This will fix #1453.