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
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions gapic/utils/reserved_names.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,15 @@
# They are explicitly allowed message, module, and field names.
RESERVED_NAMES = frozenset(
itertools.chain(
# We CANNOT make exceptions for keywords.
keyword.kwlist,
# We make SOME exceptions for certain names that collide with builtins.
set(dir(builtins)) - {"filter", "map", "id", "input", "property"},
# This is a hand-maintained list of modules that are directly imported
# in templates, i.e. they are not added as dependencies to any type,
# 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.

)
)