Skip to content

Commit 5653a46

Browse files
dizcologyparthea
andauthored
chore: remove extra newline above snippet code block (#1271)
* fix: remove extra newline above snippet code block * fix indent * update tests/integration/goldens * fix tests/integration/goldens import indents Co-authored-by: Anthonios Partheniou <partheniou@google.com>
1 parent 00d3488 commit 5653a46

13 files changed

Lines changed: 62 additions & 142 deletions

File tree

packages/gapic-generator/gapic/templates/%namespace/%name_%version/%sub/services/%service/_client_macros.j2

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,13 @@
3636
{% else %}
3737
) -> Iterable[{{ method.client_output.ident }}]:
3838
{% endif %}
39-
r"""{{ method.meta.doc|rst(width=72, indent=8) }}
39+
r"""{{ method.meta.doc|rst(width=72, indent=8)|trim }}
4040

4141
{% with snippet = snippet_index.get_snippet(service.name, method.name, sync=True) %}
4242
{% if snippet is not none %}
4343
.. code-block:: python
4444

45-
{{ snippet.full_snippet|indent(width=12, first=True) }}
45+
{{ snippet.full_snippet|indent(width=12, first=True) }}
4646
{% endif %}
4747
{% endwith %}
4848

packages/gapic-generator/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
{% else %}
210210
) -> Awaitable[AsyncIterable[{{ method.client_output_async.ident }}]]:
211211
{% endif %}
212-
r"""{{ method.meta.doc|rst(width=72, indent=8) }}
212+
r"""{{ method.meta.doc|rst(width=72, indent=8)|trim }}
213213

214214
{% with snippet = snippet_index.get_snippet(service.name, method.name, sync=True) %}
215215
{% if snippet is not none %}

packages/gapic-generator/tests/integration/goldens/asset/google/cloud/asset_v1/services/asset_service/async_client.py

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,6 @@ async def export_assets(self,
210210
the export operation result. For regular-size resource parent,
211211
the export operation usually finishes within 5 minutes.
212212
213-
214213
.. code-block:: python
215214
216215
from google.cloud import asset_v1
@@ -307,7 +306,6 @@ async def list_assets(self,
307306
r"""Lists assets with time and resource types and returns
308307
paged results in response.
309308
310-
311309
.. code-block:: python
312310
313311
from google.cloud import asset_v1
@@ -421,7 +419,6 @@ async def batch_get_assets_history(self,
421419
specified asset does not exist, this API returns an
422420
INVALID_ARGUMENT error.
423421
424-
425422
.. code-block:: python
426423
427424
from google.cloud import asset_v1
@@ -502,7 +499,6 @@ async def create_feed(self,
502499
project/folder/organization to listen to its asset
503500
updates.
504501
505-
506502
.. code-block:: python
507503
508504
from google.cloud import asset_v1
@@ -720,7 +716,6 @@ async def list_feeds(self,
720716
r"""Lists all asset feeds in a parent
721717
project/folder/organization.
722718
723-
724719
.. code-block:: python
725720
726721
from google.cloud import asset_v1
@@ -1020,7 +1015,6 @@ async def search_all_resources(self,
10201015
the ``cloudasset.assets.searchAllResources`` permission on the
10211016
desired scope, otherwise the request will be rejected.
10221017
1023-
10241018
.. code-block:: python
10251019
10261020
from google.cloud import asset_v1
@@ -1226,7 +1220,6 @@ async def search_all_iam_policies(self,
12261220
``cloudasset.assets.searchAllIamPolicies`` permission on the
12271221
desired scope, otherwise the request will be rejected.
12281222
1229-
12301223
.. code-block:: python
12311224
12321225
from google.cloud import asset_v1
@@ -1408,7 +1401,6 @@ async def analyze_iam_policy(self,
14081401
r"""Analyzes IAM policies to answer which identities have
14091402
what accesses on which resources.
14101403
1411-
14121404
.. code-block:: python
14131405
14141406
from google.cloud import asset_v1
@@ -1503,7 +1495,6 @@ async def analyze_iam_policy_longrunning(self,
15031495
to poll the operation result. The metadata contains the request
15041496
to help callers to map responses to requests.
15051497
1506-
15071498
.. code-block:: python
15081499
15091500
from google.cloud import asset_v1

packages/gapic-generator/tests/integration/goldens/asset/google/cloud/asset_v1/services/asset_service/client.py

Lines changed: 12 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -406,10 +406,9 @@ def export_assets(self,
406406
the export operation result. For regular-size resource parent,
407407
the export operation usually finishes within 5 minutes.
408408
409-
410409
.. code-block:: python
411410
412-
from google.cloud import asset_v1
411+
from google.cloud import asset_v1
413412
414413
def sample_export_assets():
415414
# Create a client
@@ -504,10 +503,9 @@ def list_assets(self,
504503
r"""Lists assets with time and resource types and returns
505504
paged results in response.
506505
507-
508506
.. code-block:: python
509507
510-
from google.cloud import asset_v1
508+
from google.cloud import asset_v1
511509
512510
def sample_list_assets():
513511
# Create a client
@@ -618,10 +616,9 @@ def batch_get_assets_history(self,
618616
specified asset does not exist, this API returns an
619617
INVALID_ARGUMENT error.
620618
621-
622619
.. code-block:: python
623620
624-
from google.cloud import asset_v1
621+
from google.cloud import asset_v1
625622
626623
def sample_batch_get_assets_history():
627624
# Create a client
@@ -694,10 +691,9 @@ def create_feed(self,
694691
project/folder/organization to listen to its asset
695692
updates.
696693
697-
698694
.. code-block:: python
699695
700-
from google.cloud import asset_v1
696+
from google.cloud import asset_v1
701697
702698
def sample_create_feed():
703699
# Create a client
@@ -807,7 +803,7 @@ def get_feed(self,
807803
808804
.. code-block:: python
809805
810-
from google.cloud import asset_v1
806+
from google.cloud import asset_v1
811807
812808
def sample_get_feed():
813809
# Create a client
@@ -906,10 +902,9 @@ def list_feeds(self,
906902
r"""Lists all asset feeds in a parent
907903
project/folder/organization.
908904
909-
910905
.. code-block:: python
911906
912-
from google.cloud import asset_v1
907+
from google.cloud import asset_v1
913908
914909
def sample_list_feeds():
915910
# Create a client
@@ -1004,7 +999,7 @@ def update_feed(self,
1004999
10051000
.. code-block:: python
10061001
1007-
from google.cloud import asset_v1
1002+
from google.cloud import asset_v1
10081003
10091004
def sample_update_feed():
10101005
# Create a client
@@ -1108,7 +1103,7 @@ def delete_feed(self,
11081103
11091104
.. code-block:: python
11101105
1111-
from google.cloud import asset_v1
1106+
from google.cloud import asset_v1
11121107
11131108
def sample_delete_feed():
11141109
# Create a client
@@ -1194,10 +1189,9 @@ def search_all_resources(self,
11941189
the ``cloudasset.assets.searchAllResources`` permission on the
11951190
desired scope, otherwise the request will be rejected.
11961191
1197-
11981192
.. code-block:: python
11991193
1200-
from google.cloud import asset_v1
1194+
from google.cloud import asset_v1
12011195
12021196
def sample_search_all_resources():
12031197
# Create a client
@@ -1394,10 +1388,9 @@ def search_all_iam_policies(self,
13941388
``cloudasset.assets.searchAllIamPolicies`` permission on the
13951389
desired scope, otherwise the request will be rejected.
13961390
1397-
13981391
.. code-block:: python
13991392
1400-
from google.cloud import asset_v1
1393+
from google.cloud import asset_v1
14011394
14021395
def sample_search_all_iam_policies():
14031396
# Create a client
@@ -1570,10 +1563,9 @@ def analyze_iam_policy(self,
15701563
r"""Analyzes IAM policies to answer which identities have
15711564
what accesses on which resources.
15721565
1573-
15741566
.. code-block:: python
15751567
1576-
from google.cloud import asset_v1
1568+
from google.cloud import asset_v1
15771569
15781570
def sample_analyze_iam_policy():
15791571
# Create a client
@@ -1660,10 +1652,9 @@ def analyze_iam_policy_longrunning(self,
16601652
to poll the operation result. The metadata contains the request
16611653
to help callers to map responses to requests.
16621654
1663-
16641655
.. code-block:: python
16651656
1666-
from google.cloud import asset_v1
1657+
from google.cloud import asset_v1
16671658
16681659
def sample_analyze_iam_policy_longrunning():
16691660
# Create a client

packages/gapic-generator/tests/integration/goldens/credentials/google/iam/credentials_v1/services/iam_credentials/async_client.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,6 @@ async def generate_access_token(self,
208208
r"""Generates an OAuth 2.0 access token for a service
209209
account.
210210
211-
212211
.. code-block:: python
213212
214213
from google.iam import credentials_v1
@@ -361,7 +360,6 @@ async def generate_id_token(self,
361360
r"""Generates an OpenID Connect ID token for a service
362361
account.
363362
364-
365363
.. code-block:: python
366364
367365
from google.iam import credentials_v1
@@ -507,7 +505,6 @@ async def sign_blob(self,
507505
r"""Signs a blob using a service account's system-managed
508506
private key.
509507
510-
511508
.. code-block:: python
512509
513510
from google.iam import credentials_v1
@@ -640,7 +637,6 @@ async def sign_jwt(self,
640637
r"""Signs a JWT using a service account's system-managed
641638
private key.
642639
643-
644640
.. code-block:: python
645641
646642
from google.iam import credentials_v1

packages/gapic-generator/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
@@ -395,10 +395,9 @@ def generate_access_token(self,
395395
r"""Generates an OAuth 2.0 access token for a service
396396
account.
397397
398-
399398
.. code-block:: python
400399
401-
from google.iam import credentials_v1
400+
from google.iam import credentials_v1
402401
403402
def sample_generate_access_token():
404403
# Create a client
@@ -542,10 +541,9 @@ def generate_id_token(self,
542541
r"""Generates an OpenID Connect ID token for a service
543542
account.
544543
545-
546544
.. code-block:: python
547545
548-
from google.iam import credentials_v1
546+
from google.iam import credentials_v1
549547
550548
def sample_generate_id_token():
551549
# Create a client
@@ -682,10 +680,9 @@ def sign_blob(self,
682680
r"""Signs a blob using a service account's system-managed
683681
private key.
684682
685-
686683
.. code-block:: python
687684
688-
from google.iam import credentials_v1
685+
from google.iam import credentials_v1
689686
690687
def sample_sign_blob():
691688
# Create a client
@@ -809,10 +806,9 @@ def sign_jwt(self,
809806
r"""Signs a JWT using a service account's system-managed
810807
private key.
811808
812-
813809
.. code-block:: python
814810
815-
from google.iam import credentials_v1
811+
from google.iam import credentials_v1
816812
817813
def sample_sign_jwt():
818814
# Create a client

0 commit comments

Comments
 (0)