Skip to content

Commit

Permalink
chore: clean up synth replacements (#161)
Browse files Browse the repository at this point in the history
- Remove those which no longer match.
- Apply '_GAPIC_LIBRARY_VERSION' tweak from PR #150.

Closes #155.
Closes #156.
  • Loading branch information
tseaver committed Nov 11, 2020
1 parent 0278363 commit ff3c577
Showing 1 changed file with 19 additions and 31 deletions.
50 changes: 19 additions & 31 deletions synth.py
Expand Up @@ -45,40 +45,28 @@
s.move(library / "google/cloud/bigtable_admin_v2")
s.move(library / "tests")

s.replace(
[
"google/cloud/bigtable_admin_v2/gapic/bigtable_instance_admin_client.py",
"google/cloud/bigtable_admin_v2/gapic/bigtable_table_admin_client.py",
],
"'google-cloud-bigtable-admin'",
"'google-cloud-bigtable'",
)

s.replace(
"google/**/*.py",
"from google\.cloud\.bigtable\.admin_v2.proto",
"from google.cloud.bigtable_admin_v2.proto",
)
# Work around non-standard installations

s.replace(
["google/cloud/bigtable_admin_v2/__init__.py"],
" __doc__ = bigtable_instance_admin_client."
"BigtableInstanceAdminClient.__doc__\n",
" __doc__ = (\n"
" bigtable_instance_admin_client.BigtableInstanceAdminClient."
"__doc__)\n",
)

s.replace(
["google/cloud/bigtable_v2/gapic/bigtable_client.py"],
"if ``true_mutations`` is empty, and at most\n\n\s*100000.",
"if ``true_mutations`` is empty, and at most 100000.",
)
admin_clients = [
"google/cloud/bigtable_admin_v2/gapic/bigtable_instance_admin_client.py",
"google/cloud/bigtable_admin_v2/gapic/bigtable_table_admin_client.py",
]

s.replace(
["google/cloud/bigtable_v2/gapic/bigtable_client.py"],
"if ``false_mutations`` is empty, and at most\n\n\s*100000.",
"if ``false_mutations`` is empty, and at most 100000.",
admin_clients,
"""\
_GAPIC_LIBRARY_VERSION = pkg_resources.get_distribution\(
'google-cloud-bigtable-admin',
\).version
""",
"""\
try:
_GAPIC_LIBRARY_VERSION = pkg_resources.get_distribution(
"google-cloud-bigtable"
).version
except pkg_resources.DistributionNotFound: # pragma: NO COVER
_GAPIC_LIBRARY_VERSION = None
"""
)

# ----------------------------------------------------------------------------
Expand Down

0 comments on commit ff3c577

Please sign in to comment.