GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — fix: updating testing, rest-only generation, & minor bug-fixes by yon-mg · Pull Request #716 · googleapis/gapic-generator-python
This repository was archived by the owner on Aug 25, 2026. It is now read-only.
Conversation
Contributor
Updating unit tests on generated client rest transport. Most changes made to unit tests are with compute api in mind and are not yet comprehensive enough for showcase. Fixed issues with rest-only transport generation. Again, changes made with compute api in mind especially since compute api doesn't have grpc endpoint. Fixed bug with attribute keyword conflicts. The goal with this PR is to be able to generate a minimum usable GCE client library. Since rest transport is still under work, it is not generated by default and must be set with the transport flag
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
yon-mg
marked this pull request as draft
vam-google
reviewed
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should this be under "if" statements?
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This construct is used everywhere in the template. Since it is so commonly used, please consider simplifying it by introducing some helper method, such that it look something like:
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
There was an error while loading. Please reload this page.
Codecov Report
@@ Coverage Diff @@ ## master #716 +/- ## ========================================= Coverage 100.00% 100.00% ========================================= Files 26 27 +1 Lines 1608 1619 +11 Branches 328 328 ========================================= + Hits 1608 1619 +11
Continue to review full report at Codecov.
|
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| import re | ||
|
|
||
|
|
||
| def is_str(expr: str) -> bool: |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
If this file is used only for testing, please put it where the testing code is. Also please make sure that we don't do anything like this (guessting field type by its value, and using regexps for it), because it is not reliable enough and is quite slow (the regexp part).
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@software-dov PTAL. This is the last PR which blocks us from generating the first Pyghon Alpha client for GCE! |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| @@ -0,0 +1,42 @@ | |||
| # Copyright 2018 Google LLC | |||
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Please use field.type instead field.mock_value in your test templates. By doing that you may avoid guessing work here, as we discussed over GVC. Also, please update copyright to 2020 here and in all your new files.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me (I am not an expert on the generator so deferring to other folks for approvals). I'm excited to try this out! 🚀
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
| query_params = ['{k}={v}'.format(k=k, v=v) for k, v in query_params.items() if v] | ||
| url += '?{}'.format('&'.join(query_params)).replace(' ', '+') |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
It might be easier to use urllib.parse.urlencode here (It will create the k=v structure and glue the pairs together with & characters).
https://docs.python.org/3/library/urllib.parse.html#urllib.parse.urlencode
https://docs.python.org/3/library/urllib.request.html#urllib-examples
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Not sure how I missed this. Thanks!
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
To clarify, I'll leave this out for now so I don't accidentally break anything but I'll update in the subsequent PR
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Co-authored-by: Bu Sun Kim <[email protected]>
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Did a quick once-over. Looks good! Thanks for doing this.
Two very minor comments.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| {% endif %} | ||
|
|
||
| {% if "next_page_token" in method.output.fields.values()|map(attribute='name') and not method.paged_result_field %} | ||
| {# Cheeser assertion to force code coverage for bad paginated methods #} |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
What does "cheeser" mean in this context?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| "foo/some_service/transports/car.py", | ||
| "foo/some_service/transports/__init__.py", | ||
| "foo/some_service/transports/base.py", | ||
| # Only generate async client with grpc transport |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
nit: This comment looks as thought it applies to the next line, but is a bit confusing. Suggest moving it below the next line and tweaking it to be something like: # no async_client.py, as that's only for grpc transport
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
Re-add HTTP transport and make it the fallback
There was an error while loading. Please reload this page.