Skip to content

Commit 470fb5a

Browse files
committed
Add synth fixups for contortions in generated docstrings.
1 parent 6837a87 commit 470fb5a

4 files changed

Lines changed: 163 additions & 35 deletions

File tree

spanner/google/cloud/spanner_admin_database_v1/gapic/database_admin_client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,7 @@ def create_database(self,
322322
new database. The database ID must conform to the regular expression
323323
``[a-z][a-z0-9_\-]*[a-z0-9]`` and be between 2 and 30 characters in length.
324324
If the database ID is a reserved word or if it contains a hyphen, the
325-
database ID must be enclosed in backticks (`` `` ``).
325+
database ID must be enclosed in backticks.
326326
extra_statements (list[str]): An optional list of DDL statements to run inside the newly created
327327
database. Statements can create tables, indexes, etc. These
328328
statements execute atomically with the creation of the database:

spanner/google/cloud/spanner_admin_instance_v1/gapic/instance_admin_client.py

Lines changed: 18 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -412,15 +412,11 @@ def list_instances(self,
412412
* ``name:HOWL`` --> Equivalent to above.
413413
* ``NAME:howl`` --> Equivalent to above.
414414
* ``labels.env:*`` --> The instance has the label \"env\".
415-
* ``labels.env:dev`` --> The instance has the label \"env\" and the value of
416-
::
417-
418-
the label contains the string \"dev\".
419-
* ``name:howl labels.env:dev`` --> The instance's name contains \"howl\" and
420-
::
421-
422-
it has the label \"env\" with its value
423-
containing \"dev\".
415+
* ``labels.env:dev`` --> The instance has the label \"env\"
416+
and the value of the label contains the string \"dev\".
417+
* ``name:howl labels.env:dev`` --> The instance's name
418+
contains \"howl\" and it has the label \"env\" with
419+
its value containing \"dev\".
424420
retry (Optional[google.api_core.retry.Retry]): A retry object used
425421
to retry requests. If ``None`` is specified, requests will not
426422
be retried.
@@ -545,19 +541,19 @@ def create_instance(self,
545541
Immediately upon completion of this request:
546542
547543
* The instance is readable via the API, with all requested attributes
548-
but no allocated resources. Its state is `CREATING`.
544+
but no allocated resources. Its state is `CREATING`.
549545
550546
Until completion of the returned operation:
551547
552548
* Cancelling the operation renders the instance immediately unreadable
553-
via the API.
549+
via the API.
554550
* The instance can be deleted.
555551
* All other attempts to modify the instance are rejected.
556552
557553
Upon completion of the returned operation:
558554
559555
* Billing for all successfully-allocated resources begins (some types
560-
may have lower than the requested levels).
556+
may have lower than the requested levels).
561557
* Databases can be created in the instance.
562558
* The instance's allocated resource levels are readable via the API.
563559
* The instance's state becomes ``READY``.
@@ -664,25 +660,25 @@ def update_instance(self,
664660
Immediately upon completion of this request:
665661
666662
* For resource types for which a decrease in the instance's allocation
667-
has been requested, billing is based on the newly-requested level.
663+
has been requested, billing is based on the newly-requested level.
668664
669665
Until completion of the returned operation:
670666
671667
* Cancelling the operation sets its metadata's
672-
[cancel_time][google.spanner.admin.instance.v1.UpdateInstanceMetadata.cancel_time], and begins
673-
restoring resources to their pre-request values. The operation
674-
is guaranteed to succeed at undoing all resource changes,
675-
after which point it terminates with a `CANCELLED` status.
668+
[cancel_time][google.spanner.admin.instance.v1.UpdateInstanceMetadata.cancel_time],
669+
and begins restoring resources to their pre-request values.
670+
The operation is guaranteed to succeed at undoing all resource
671+
changes, after which point it terminates with a `CANCELLED` status.
676672
* All other attempts to modify the instance are rejected.
677673
* Reading the instance via the API continues to give the pre-request
678-
resource levels.
674+
resource levels.
679675
680676
Upon completion of the returned operation:
681677
682678
* Billing begins for all successfully-allocated resources (some types
683-
may have lower than the requested levels).
679+
may have lower than the requested levels).
684680
* All newly-reserved resources are available for serving the instance's
685-
tables.
681+
tables.
686682
* The instance's new resource levels are readable via the API.
687683
688684
The returned ``long-running operation`` will
@@ -787,8 +783,8 @@ def delete_instance(self,
787783
Soon afterward:
788784
789785
* The instance and *all of its databases* immediately and
790-
irrevocably disappear from the API. All data in the databases
791-
is permanently deleted.
786+
irrevocably disappear from the API. All data in the databases
787+
is permanently deleted.
792788
793789
Example:
794790
>>> from google.cloud import spanner_admin_instance_v1

spanner/google/cloud/spanner_v1/proto/transaction_pb2.py

Lines changed: 12 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

spanner/synth.py

Lines changed: 132 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,131 @@
8787
'from google.cloud.spanner_admin_instance_v1.proto',
8888
)
8989

90+
# Fix docstrings
91+
s.replace(
92+
'google/cloud/spanner_admin_instance_v1/gapic/instance_admin_client.py',
93+
r"""
94+
\* The instance is readable via the API, with all requested attributes
95+
but no allocated resources. Its state is `CREATING`.""",
96+
r"""
97+
* The instance is readable via the API, with all requested attributes
98+
but no allocated resources. Its state is `CREATING`.""",
99+
)
100+
s.replace(
101+
'google/cloud/spanner_admin_instance_v1/gapic/instance_admin_client.py',
102+
r"""
103+
\* Cancelling the operation renders the instance immediately unreadable
104+
via the API.""",
105+
r"""
106+
* Cancelling the operation renders the instance immediately unreadable
107+
via the API.""",
108+
)
109+
s.replace(
110+
'google/cloud/spanner_admin_instance_v1/gapic/instance_admin_client.py',
111+
r"""
112+
\* Billing for all successfully-allocated resources begins \(some types
113+
may have lower than the requested levels\).""",
114+
r"""
115+
* Billing for all successfully-allocated resources begins (some types
116+
may have lower than the requested levels).""",
117+
)
118+
s.replace(
119+
'google/cloud/spanner_admin_instance_v1/gapic/instance_admin_client.py',
120+
r"""
121+
\* The instance and \*all of its databases\* immediately and
122+
irrevocably disappear from the API. All data in the databases
123+
is permanently deleted.""",
124+
r"""
125+
* The instance and *all of its databases* immediately and
126+
irrevocably disappear from the API. All data in the databases
127+
is permanently deleted.""",
128+
)
129+
s.replace(
130+
'google/cloud/spanner_admin_instance_v1/gapic/instance_admin_client.py',
131+
r"""
132+
\* ``labels.env:dev`` --> The instance has the label \\"env\\" and the value of
133+
::
134+
135+
the label contains the string \\"dev\\".""",
136+
r"""
137+
* ``labels.env:dev`` --> The instance has the label \\"env\\"
138+
and the value of the label contains the string \\"dev\\".""",
139+
)
140+
s.replace(
141+
'google/cloud/spanner_admin_instance_v1/gapic/instance_admin_client.py',
142+
r"""
143+
\* ``name:howl labels.env:dev`` --> The instance's name contains \\"howl\\" and
144+
::
145+
146+
it has the label \\"env\\" with its value
147+
containing \\"dev\\".""",
148+
r"""
149+
* ``name:howl labels.env:dev`` --> The instance's name
150+
contains \\"howl\\" and it has the label \\"env\\" with
151+
its value containing \\"dev\\".""",
152+
)
153+
s.replace(
154+
'google/cloud/spanner_admin_instance_v1/gapic/instance_admin_client.py',
155+
r"""
156+
\* For resource types for which a decrease in the instance's allocation
157+
has been requested, billing is based on the newly-requested level.""",
158+
r"""
159+
* For resource types for which a decrease in the instance's allocation
160+
has been requested, billing is based on the newly-requested level.""",
161+
)
162+
s.replace(
163+
'google/cloud/spanner_admin_instance_v1/gapic/instance_admin_client.py',
164+
r"""
165+
\* Cancelling the operation sets its metadata's
166+
\[cancel_time\]\[google.spanner.admin.instance.v1.UpdateInstanceMetadata.cancel_time\], and begins
167+
restoring resources to their pre-request values. The operation
168+
is guaranteed to succeed at undoing all resource changes,
169+
after which point it terminates with a `CANCELLED` status.""",
170+
r"""
171+
* Cancelling the operation sets its metadata's
172+
[cancel_time][google.spanner.admin.instance.v1.UpdateInstanceMetadata.cancel_time],
173+
and begins restoring resources to their pre-request values.
174+
The operation is guaranteed to succeed at undoing all resource
175+
changes, after which point it terminates with a `CANCELLED` status.""",
176+
)
177+
s.replace(
178+
'google/cloud/spanner_admin_instance_v1/gapic/instance_admin_client.py',
179+
r"""
180+
\* Reading the instance via the API continues to give the pre-request
181+
resource levels.""",
182+
r"""
183+
* Reading the instance via the API continues to give the pre-request
184+
resource levels.""",
185+
)
186+
s.replace(
187+
'google/cloud/spanner_admin_instance_v1/gapic/instance_admin_client.py',
188+
r"""
189+
\* Billing begins for all successfully-allocated resources \(some types
190+
may have lower than the requested levels\).
191+
\* All newly-reserved resources are available for serving the instance's
192+
tables.""",
193+
r"""
194+
* Billing begins for all successfully-allocated resources (some types
195+
may have lower than the requested levels).
196+
* All newly-reserved resources are available for serving the instance's
197+
tables.""",
198+
)
199+
s.replace(
200+
'google/cloud/spanner_v1/proto/transaction_pb2.py',
201+
r"""====*""",
202+
r"",
203+
)
204+
s.replace(
205+
'google/cloud/spanner_v1/proto/transaction_pb2.py',
206+
r"""----*""",
207+
r"",
208+
)
209+
s.replace(
210+
'google/cloud/spanner_v1/proto/transaction_pb2.py',
211+
r"""~~~~*""",
212+
r"",
213+
)
214+
90215
#----------------------------------------------------------------------------
91216
# Generate database admin client
92217
#----------------------------------------------------------------------------
@@ -114,3 +239,10 @@
114239
'from google\.cloud\.spanner\.admin\.database_v1.proto',
115240
'from google.cloud.spanner_admin_database_v1.proto',
116241
)
242+
243+
# Fix docstrings
244+
s.replace(
245+
'google/cloud/spanner_admin_database_v1/gapic/database_admin_client.py',
246+
r'database ID must be enclosed in backticks \(`` `` ``\).',
247+
r'database ID must be enclosed in backticks.',
248+
)

0 commit comments

Comments
 (0)