Skip to content

Commit

Permalink
Assorted synth fixups / cleanups (#6400)
Browse files Browse the repository at this point in the history
* Asset: Replace 'stable' -> 'latest' in docs links, caused by out-of-date synth.
* AutoML: fix copying generated docs.
* Bigtable: remove now-spurious fixup from 'synth.py'.
* DLP: remove now-spurious fixups from 'synth.py'.
* Monitoring: remove now-spurious fixups from 'synth.py'.
* Redis: remove now-spurious fixups from 'synth.py'.
* Speech: remove now-spurious fixups from 'synth.py'.
  • Loading branch information
tseaver authored Nov 7, 2018
1 parent d767532 commit b0760f2
Show file tree
Hide file tree
Showing 7 changed files with 4 additions and 87 deletions.
2 changes: 1 addition & 1 deletion automl/synth.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
library = gapic.py_library('automl', version)
s.move(library / f'google/cloud/automl_{version}')
s.move(library / f'tests/unit/gapic/{version}')
s.move(library / f'docs/gapic/automl/{version}')
s.move(library / f'docs/gapic/{version}')

# Use the highest version library to generate import alias.
s.move(library / 'google/cloud/automl.py')
Expand Down
4 changes: 0 additions & 4 deletions bigtable/synth.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,6 @@
"google/**/*.py",
'from google\.cloud\.bigtable\.admin_v2.proto',
'from google.cloud.bigtable_admin_v2.proto')
s.replace(
"tests/**/*.py",
'from google\.cloud\.bigtable\.admin_v2.proto',
'from google.cloud.bigtable_admin_v2.proto')

s.replace(
['google/cloud/bigtable_admin_v2/gapic/transports/'
Expand Down
14 changes: 0 additions & 14 deletions dlp/synth.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,6 @@
"google\.cloud\.privacy\.dlp_v2",
"google.cloud.dlp_v2"
)
s.replace(
"tests/**/*.py",
"google\.cloud\.privacy\.dlp_v2",
"google.cloud.dlp_v2"
)

# Add missing utf-8 marker
s.replace(
Expand Down Expand Up @@ -82,15 +77,6 @@
"\g<1> \\\n\g<2> \\\n"
)

s.replace(
"google/cloud/dlp_v2/proto/storage_pb2.py",
"(proximity:)\n(\s+Proximity.*)\n(\s+reside..*)\n(\s+characters..*)\n"
"(\s+the window.*)\n(\s+of the finding.*)\n(\s+number regex.*)\n"
"(\s+latex:.*)\n(\s+known to be the local.*)\n(\s+hotword regex.*)\n",
"\g<1> \\\n\g<2> \\\n\g<3> \\\n\g<4> \\\n\g<5> \\\n\g<6> \\\n\g<7> "
"\\\n\g<8> \\\n\g<9> \\\n\g<10> \\\n"
)

s.replace(
"google/cloud/dlp_v2/proto/storage_pb2.py",
"(likelihood_adjustment:)\n",
Expand Down
20 changes: 0 additions & 20 deletions monitoring/synth.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,6 @@
]
s.copy(v3_library, excludes=excludes)

# Correct calls to routing_header
# https://github.com/googleapis/gapic-generator/issues/2016
s.replace(
"google/cloud/*/gapic/*_client.py",
"routing_header\(",
"routing_header.to_grpc_metadata(")

# metadata in tests in none but should be empty list.
# https://github.com/googleapis/gapic-generator/issues/2014
s.replace(
Expand All @@ -54,19 +47,6 @@
' metadata = []\n'
' metadata = list(metadata)\n')


# empty objects trying to get attrs
# https://github.com/googleapis/gapic-generator/issues/2015
s.replace(
"google/cloud/*/gapic/*_client.py",
"(^ )(routing_header = google.api_core.gapic_v1.routing_header"
".to_grpc_metadata\(\n)"
"(\s+)(\[\('[a-z\_]*?\.name', )([a-z\_]*?)(.name\)\], \)\n)"
"(\s+metadata.append\(routing_header\)\n)",
"\g<1>if hasattr(\g<5>, 'name'):\n"
"\g<1> \g<2>\g<3> \g<4>\g<5>\g<6> \g<7>"
)

# Issues exist where python files should defined the source encoding
# https://github.com/googleapis/gapic-generator/issues/2097
files = ['google/cloud/monitoring_v3/proto/common_pb2.py']
Expand Down
31 changes: 0 additions & 31 deletions redis/synth.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,34 +92,3 @@

r"""
fields from ``Instance``: ``displayName``, ``labels``, ``memorySizeGb``, and ``redisConfig``.""",)

# Set Release Status
release_status = 'Development Status :: 3 - Alpha'
s.replace('setup.py',
'(release_status = )(.*)$',
f"\\1'{release_status}'")

# Fix the enable API link
s.replace(
'README.rst',
r'.. _Enable the Google Cloud Memorystore for Redis API.: https://cloud.google.com/redis',
'.. _Enable the Google Cloud Memorystore for Redis API.: https://console.cloud.google.com/apis/'
'library/redis.googleapis.com')

# Fix link to product page
s.replace(
'README.rst',
r'https://cloud.google.com/redis',
'https://cloud.google.com/memorystore/')

# Fix link to Client Library Documentation
s.replace(
'README.rst',
r'https://googlecloudplatform.github.io/google-cloud-python/stable/redis/usage.html',
'https://googlecloudplatform.github.io/google-cloud-python/latest/redis/index.html')

# Fix link to Auth instructions
s.replace(
'README.rst',
r'https://googlecloudplatform.github.io/google-cloud-python/stable/core/auth.html',
'https://googlecloudplatform.github.io/google-cloud-python/latest/core/auth.html')
6 changes: 3 additions & 3 deletions securitycenter/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Python Client for Cloud Security Command Center API (`Alpha`_)
:target: https://pypi.org/project/google-cloud-securitycenter/
.. _Alpha: https://github.com/GoogleCloudPlatform/google-cloud-python/blob/master/README.rst
.. _Cloud Security Command Center API: https://cloud.google.com/security-command-center
.. _Client Library Documentation: https://googlecloudplatform.github.io/google-cloud-python/stable/securitycenter/usage.html
.. _Client Library Documentation: https://googlecloudplatform.github.io/google-cloud-python/latest/securitycenter/usage.html
.. _Product Documentation: https://cloud.google.com/security-command-center


Expand All @@ -32,7 +32,7 @@ In order to use this library, you first need to go through the following steps:
.. _Select or create a Cloud Platform project.: https://console.cloud.google.com/project
.. _Enable billing for your project.: https://cloud.google.com/billing/docs/how-to/modify-project#enable_billing_for_a_project
.. _Enable the Cloud Security Command Center API.: https://cloud.google.com/security-command-center
.. _Setup Authentication.: https://googlecloudplatform.github.io/google-cloud-python/stable/core/auth.html
.. _Setup Authentication.: https://googlecloudplatform.github.io/google-cloud-python/latest/core/auth.html

Installation
~~~~~~~~~~~~
Expand Down Expand Up @@ -80,4 +80,4 @@ Next Steps
APIs that we cover.

.. _Cloud Security Command Center API Product documentation: https://cloud.google.com/security-command-center
.. _repository’s main README: https://github.com/GoogleCloudPlatform/google-cloud-python/blob/master/README.rst
.. _repository’s main README: https://github.com/GoogleCloudPlatform/google-cloud-python/blob/master/README.rst
14 changes: 0 additions & 14 deletions speech/synth.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,20 +40,6 @@
s.move(library / 'google/cloud/speech.py')


# Fix bad reference to operations_v1
s.replace(
'**/gapic/**/*_transport.py',
r' \= operations_v1\.',
' = google.api_core.operations_v1.')


# Fix bad docstrings.
s.replace(
'**/gapic/*_client.py',
r'\\"(.+?)-\*\\"',
r'"\1-\\*"')


# Issues exist where python files should define the source encoding
# https://github.com/googleapis/gapic-generator/issues/2097
s.replace(
Expand Down

0 comments on commit b0760f2

Please sign in to comment.