Skip to content

Commit 500dfe7

Browse files
busunkim96dandhlee
andauthored
fix: fix docstring code block formatting (googleapis#1206)
Add `python` to code-blocks and use a consistent number of newlines. Addresses issues identified in 219067629. Co-authored-by: Dan Lee <71398022+dandhlee@users.noreply.github.com>
1 parent fd2f500 commit 500dfe7

File tree

16 files changed

+122
-182
lines changed

16 files changed

+122
-182
lines changed

gapic/ads-templates/%namespace/%name/%version/%sub/services/%service/transports/rest.py.j2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ class {{ service.name }}RestInterceptor:
6666
These use cases and more can be enabled by injecting an
6767
instance of a custom subclass when constructing the {{ service.name }}RestTransport.
6868

69-
.. code-block:
69+
.. code-block:: python
7070
class MyCustom{{ service.name }}Interceptor({{ service.name }}RestInterceptor):
7171
{% for _, method in service.methods|dictsort if not method.client_streaming %}
7272
def pre_{{ method.name|snake_case }}(request, metadata):

gapic/templates/%namespace/%name_%version/%sub/services/%service/async_client.py.j2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ class {{ service.async_client_name }}:
209209

210210
{% with snippet = snippet_index.get_snippet(service.name, method.name, sync=True) %}
211211
{% if snippet is not none %}
212-
.. code-block::
212+
.. code-block:: python
213213

214214
{{ snippet.full_snippet|indent(width=12, first=True) }}
215215
{% endif %}

gapic/templates/%namespace/%name_%version/%sub/services/%service/client.py.j2

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -371,11 +371,10 @@ class {{ service.client_name }}(metaclass={{ service.client_name }}Meta):
371371
) -> Iterable[{{ method.client_output.ident }}]:
372372
{% endif %}
373373
r"""{{ method.meta.doc|rst(width=72, indent=8) }}
374-
375374

376375
{% with snippet = snippet_index.get_snippet(service.name, method.name, sync=True) %}
377376
{% if snippet is not none %}
378-
.. code-block::
377+
.. code-block:: python
379378

380379
{{ snippet.full_snippet|indent(width=12, first=True) }}
381380
{% endif %}

gapic/templates/%namespace/%name_%version/%sub/services/%service/transports/rest.py.j2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ class {{ service.name }}RestInterceptor:
6666
These use cases and more can be enabled by injecting an
6767
instance of a custom subclass when constructing the {{ service.name }}RestTransport.
6868

69-
.. code-block:
69+
.. code-block:: python
7070
class MyCustom{{ service.name }}Interceptor({{ service.name }}RestInterceptor):
7171
{% for _, method in service.methods|dictsort if not method.client_streaming %}
7272
def pre_{{ method.name|snake_case }}(request, metadata):

tests/integration/goldens/asset/google/cloud/asset_v1/services/asset_service/async_client.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ async def export_assets(self,
211211
the export operation usually finishes within 5 minutes.
212212
213213
214-
.. code-block::
214+
.. code-block:: python
215215
216216
from google.cloud import asset_v1
217217
@@ -308,7 +308,7 @@ async def list_assets(self,
308308
paged results in response.
309309
310310
311-
.. code-block::
311+
.. code-block:: python
312312
313313
from google.cloud import asset_v1
314314
@@ -422,7 +422,7 @@ async def batch_get_assets_history(self,
422422
INVALID_ARGUMENT error.
423423
424424
425-
.. code-block::
425+
.. code-block:: python
426426
427427
from google.cloud import asset_v1
428428
@@ -504,7 +504,7 @@ async def create_feed(self,
504504
updates.
505505
506506
507-
.. code-block::
507+
.. code-block:: python
508508
509509
from google.cloud import asset_v1
510510
@@ -614,7 +614,7 @@ async def get_feed(self,
614614
) -> asset_service.Feed:
615615
r"""Gets details about an asset feed.
616616
617-
.. code-block::
617+
.. code-block:: python
618618
619619
from google.cloud import asset_v1
620620
@@ -723,7 +723,7 @@ async def list_feeds(self,
723723
project/folder/organization.
724724
725725
726-
.. code-block::
726+
.. code-block:: python
727727
728728
from google.cloud import asset_v1
729729
@@ -825,7 +825,7 @@ async def update_feed(self,
825825
) -> asset_service.Feed:
826826
r"""Updates an asset feed configuration.
827827
828-
.. code-block::
828+
.. code-block:: python
829829
830830
from google.cloud import asset_v1
831831
@@ -929,7 +929,7 @@ async def delete_feed(self,
929929
) -> None:
930930
r"""Deletes an asset feed.
931931
932-
.. code-block::
932+
.. code-block:: python
933933
934934
from google.cloud import asset_v1
935935
@@ -1025,7 +1025,7 @@ async def search_all_resources(self,
10251025
desired scope, otherwise the request will be rejected.
10261026
10271027
1028-
.. code-block::
1028+
.. code-block:: python
10291029
10301030
from google.cloud import asset_v1
10311031
@@ -1232,7 +1232,7 @@ async def search_all_iam_policies(self,
12321232
desired scope, otherwise the request will be rejected.
12331233
12341234
1235-
.. code-block::
1235+
.. code-block:: python
12361236
12371237
from google.cloud import asset_v1
12381238
@@ -1415,7 +1415,7 @@ async def analyze_iam_policy(self,
14151415
what accesses on which resources.
14161416
14171417
1418-
.. code-block::
1418+
.. code-block:: python
14191419
14201420
from google.cloud import asset_v1
14211421
@@ -1510,7 +1510,7 @@ async def analyze_iam_policy_longrunning(self,
15101510
to help callers to map responses to requests.
15111511
15121512
1513-
.. code-block::
1513+
.. code-block:: python
15141514
15151515
from google.cloud import asset_v1
15161516

tests/integration/goldens/asset/google/cloud/asset_v1/services/asset_service/client.py

Lines changed: 12 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -407,8 +407,7 @@ def export_assets(self,
407407
the export operation usually finishes within 5 minutes.
408408
409409
410-
411-
.. code-block::
410+
.. code-block:: python
412411
413412
from google.cloud import asset_v1
414413
@@ -506,8 +505,7 @@ def list_assets(self,
506505
paged results in response.
507506
508507
509-
510-
.. code-block::
508+
.. code-block:: python
511509
512510
from google.cloud import asset_v1
513511
@@ -621,8 +619,7 @@ def batch_get_assets_history(self,
621619
INVALID_ARGUMENT error.
622620
623621
624-
625-
.. code-block::
622+
.. code-block:: python
626623
627624
from google.cloud import asset_v1
628625
@@ -698,8 +695,7 @@ def create_feed(self,
698695
updates.
699696
700697
701-
702-
.. code-block::
698+
.. code-block:: python
703699
704700
from google.cloud import asset_v1
705701
@@ -809,8 +805,7 @@ def get_feed(self,
809805
) -> asset_service.Feed:
810806
r"""Gets details about an asset feed.
811807
812-
813-
.. code-block::
808+
.. code-block:: python
814809
815810
from google.cloud import asset_v1
816811
@@ -912,8 +907,7 @@ def list_feeds(self,
912907
project/folder/organization.
913908
914909
915-
916-
.. code-block::
910+
.. code-block:: python
917911
918912
from google.cloud import asset_v1
919913
@@ -1008,8 +1002,7 @@ def update_feed(self,
10081002
) -> asset_service.Feed:
10091003
r"""Updates an asset feed configuration.
10101004
1011-
1012-
.. code-block::
1005+
.. code-block:: python
10131006
10141007
from google.cloud import asset_v1
10151008
@@ -1113,8 +1106,7 @@ def delete_feed(self,
11131106
) -> None:
11141107
r"""Deletes an asset feed.
11151108
1116-
1117-
.. code-block::
1109+
.. code-block:: python
11181110
11191111
from google.cloud import asset_v1
11201112
@@ -1203,8 +1195,7 @@ def search_all_resources(self,
12031195
desired scope, otherwise the request will be rejected.
12041196
12051197
1206-
1207-
.. code-block::
1198+
.. code-block:: python
12081199
12091200
from google.cloud import asset_v1
12101201
@@ -1404,8 +1395,7 @@ def search_all_iam_policies(self,
14041395
desired scope, otherwise the request will be rejected.
14051396
14061397
1407-
1408-
.. code-block::
1398+
.. code-block:: python
14091399
14101400
from google.cloud import asset_v1
14111401
@@ -1581,8 +1571,7 @@ def analyze_iam_policy(self,
15811571
what accesses on which resources.
15821572
15831573
1584-
1585-
.. code-block::
1574+
.. code-block:: python
15861575
15871576
from google.cloud import asset_v1
15881577
@@ -1672,8 +1661,7 @@ def analyze_iam_policy_longrunning(self,
16721661
to help callers to map responses to requests.
16731662
16741663
1675-
1676-
.. code-block::
1664+
.. code-block:: python
16771665
16781666
from google.cloud import asset_v1
16791667

tests/integration/goldens/credentials/google/iam/credentials_v1/services/iam_credentials/async_client.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ async def generate_access_token(self,
209209
account.
210210
211211
212-
.. code-block::
212+
.. code-block:: python
213213
214214
from google.iam import credentials_v1
215215
@@ -363,7 +363,7 @@ async def generate_id_token(self,
363363
account.
364364
365365
366-
.. code-block::
366+
.. code-block:: python
367367
368368
from google.iam import credentials_v1
369369
@@ -510,7 +510,7 @@ async def sign_blob(self,
510510
private key.
511511
512512
513-
.. code-block::
513+
.. code-block:: python
514514
515515
from google.iam import credentials_v1
516516
@@ -644,7 +644,7 @@ async def sign_jwt(self,
644644
private key.
645645
646646
647-
.. code-block::
647+
.. code-block:: python
648648
649649
from google.iam import credentials_v1
650650

tests/integration/goldens/credentials/google/iam/credentials_v1/services/iam_credentials/client.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -396,8 +396,7 @@ def generate_access_token(self,
396396
account.
397397
398398
399-
400-
.. code-block::
399+
.. code-block:: python
401400
402401
from google.iam import credentials_v1
403402
@@ -544,8 +543,7 @@ def generate_id_token(self,
544543
account.
545544
546545
547-
548-
.. code-block::
546+
.. code-block:: python
549547
550548
from google.iam import credentials_v1
551549
@@ -685,8 +683,7 @@ def sign_blob(self,
685683
private key.
686684
687685
688-
689-
.. code-block::
686+
.. code-block:: python
690687
691688
from google.iam import credentials_v1
692689
@@ -813,8 +810,7 @@ def sign_jwt(self,
813810
private key.
814811
815812
816-
817-
.. code-block::
813+
.. code-block:: python
818814
819815
from google.iam import credentials_v1
820816

0 commit comments

Comments
 (0)