-
Notifications
You must be signed in to change notification settings - Fork 69
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: improper types in pagers generation #970
Conversation
Generators are Iterators not Iterables https://docs.python.org/3/library/typing.html#typing.Generator
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The change is correct, if a bit nit-picky (Iterable
is a less restrictive contract than Iterator
, and a strict superset). Do we have cases where type-checking actually complains about the difference? I guess that would be clients calling next(thing)
directly?
This is not quite correct. Iterables are not required to have In fact, you can see this with <*>Pager itself: it is an Iterable (with |
@dpcollins-google could you update the golden files? That should resolve the one failing |
@dpcollins-google I think we are in violent agreement here: At any rate, my question remains: do we have reported errors from |
It looks like this is causing a problem for Pub/Sub (see log, so I'm inclined to merge it now and re-visit if it causes an issue. @software-dov @atulep Could you also take a look as the generator owners? |
To clarify, the issue this is causing is that PyType detects that its wrong: the pager object itself is NOT an Iterator because its |
From https://docs.python.org/3/library/typing.html#typing.Generator, generator can have a return type of either Does Pub/Sub fail because a caller of the |
Please see my comment above. The Pager itself does not model |
🤖 I have created a release \*beep\* \*boop\* --- ## [0.52.0](https://www.github.com/googleapis/gapic-generator-python/compare/v0.51.2...v0.52.0) (2021-09-29) ### Features * Support alternative http bindings in the gapic schema. ([#993](https://www.github.com/googleapis/gapic-generator-python/issues/993)) ([041a726](https://www.github.com/googleapis/gapic-generator-python/commit/041a726b818cd67812d689c23757f31ec9964d66)) ### Bug Fixes * improper types in pagers generation ([#970](https://www.github.com/googleapis/gapic-generator-python/issues/970)) ([bba3eea](https://www.github.com/googleapis/gapic-generator-python/commit/bba3eea5d45fe57c0395ceef30402ad7880013d7)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
Generators are Iterators not Iterables https://docs.python.org/3/library/typing.html#typing.Generator