Skip to content
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: add certain raw imports to RESERVED_NAMES #824

Merged

Conversation

software-dov
Copy link
Contributor

The current example is 'auth', which is imported directly by both
transports and unit tests. This name conflicts with any calculated
dependency import whose name happens to be 'auth'.
Fix involves adding 'auth' and other direct, raw imports in templates
to RESERVED_NAMES.

The current example is 'auth', which is imported directly by both
transports and unit tests. This name conflicts with any calculated
dependency import whose name happens to be 'auth'.
Fix involves adding 'auth' and other direct, raw imports in templates
to RESERVED_NAMES.
@software-dov software-dov requested review from busunkim96, arithmetic1728 and a team March 23, 2021 22:28
@google-cla google-cla bot added the cla: yes This human has signed the Contributor License Agreement. label Mar 23, 2021
@codecov
Copy link

codecov bot commented Mar 23, 2021

Codecov Report

Merging #824 (86be7d8) into master (7c185e8) will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff            @@
##            master      #824   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           26        27    +1     
  Lines         1608      1653   +45     
  Branches       328       337    +9     
=========================================
+ Hits          1608      1653   +45     
Impacted Files Coverage Δ
gapic/schema/metadata.py 100.00% <ø> (ø)
gapic/utils/case.py 100.00% <ø> (ø)
gapic/utils/reserved_names.py 100.00% <ø> (ø)
gapic/generator/generator.py 100.00% <100.00%> (ø)
gapic/schema/api.py 100.00% <100.00%> (ø)
gapic/schema/wrappers.py 100.00% <100.00%> (ø)
gapic/utils/__init__.py 100.00% <100.00%> (ø)
gapic/utils/checks.py 100.00% <100.00%> (ø)
gapic/utils/options.py 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 1de2e14...86be7d8. Read the comment docs.

@software-dov software-dov added the automerge Merge the pull request once unit tests and other checks pass. label Mar 24, 2021
@gcf-merge-on-green gcf-merge-on-green bot merged commit 04bd8aa into googleapis:master Mar 24, 2021
@gcf-merge-on-green gcf-merge-on-green bot removed the automerge Merge the pull request once unit tests and other checks pass. label Mar 24, 2021
# the raw text is just there in the template.
# More can be added as collisions are discovered.
# See issue #819 for additional info.
{"auth", "credentials", "exceptions", "future", "options", "policy", "math"}
Copy link
Contributor

Choose a reason for hiding this comment

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

policy was a field name in the Dataproc API so the addition of policy to RESERVED_NAMES resulted in a breaking change. googleapis/python-dataproc#158 Patching over with a synth replace for now.

busunkim96 added a commit that referenced this pull request Apr 28, 2021
busunkim96 added a commit that referenced this pull request Apr 30, 2021
)

Fixes #835.

Breakdown by name that was originally added in #824
- `auth`: `from google import auth` -> `import google.auth`
- `credentials`: `from google.auth import credentials` -> `from google.auth import credentials as ga_credentials`
- `exceptions`: `from google.api_core import exceptions` -> `from google.api_core import exceptions as core_exceptions`
- `future`: skipped, as it is only used in the [generated tests](https://github.com/googleapis/gapic-generator-python/search?q=%22import+future%22) and has a low chance of colliding
- `options` `from google.iam.v1 import options_pb2 as options` -> `from google.iam.v1 import options_pb2`
- `policy` `from google.iam.v1 import policy_pb2 as policy` -> `from google.iam.v1 import policy_pb2`
- `math` skipped as it is only used in [generated tests](https://github.com/googleapis/gapic-generator-python/search?q=%22import+math%22)

For `options` and `policy` there is a small change to `gapic/schema/metadata.py` to not alias `_pb2` types
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes This human has signed the Contributor License Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants