Skip to content

Commit

Permalink
fix: fix docstring code block formatting (#1206)
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
busunkim96 and dandhlee authored Feb 15, 2022
1 parent fd2f500 commit 500dfe7
Show file tree
Hide file tree
Showing 16 changed files with 122 additions and 182 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ class {{ service.name }}RestInterceptor:
These use cases and more can be enabled by injecting an
instance of a custom subclass when constructing the {{ service.name }}RestTransport.

.. code-block:
.. code-block:: python
class MyCustom{{ service.name }}Interceptor({{ service.name }}RestInterceptor):
{% for _, method in service.methods|dictsort if not method.client_streaming %}
def pre_{{ method.name|snake_case }}(request, metadata):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ class {{ service.async_client_name }}:

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

{{ snippet.full_snippet|indent(width=12, first=True) }}
{% endif %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -371,11 +371,10 @@ class {{ service.client_name }}(metaclass={{ service.client_name }}Meta):
) -> Iterable[{{ method.client_output.ident }}]:
{% endif %}
r"""{{ method.meta.doc|rst(width=72, indent=8) }}


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

{{ snippet.full_snippet|indent(width=12, first=True) }}
{% endif %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ class {{ service.name }}RestInterceptor:
These use cases and more can be enabled by injecting an
instance of a custom subclass when constructing the {{ service.name }}RestTransport.

.. code-block:
.. code-block:: python
class MyCustom{{ service.name }}Interceptor({{ service.name }}RestInterceptor):
{% for _, method in service.methods|dictsort if not method.client_streaming %}
def pre_{{ method.name|snake_case }}(request, metadata):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ async def export_assets(self,
the export operation usually finishes within 5 minutes.
.. code-block::
.. code-block:: python
from google.cloud import asset_v1
Expand Down Expand Up @@ -308,7 +308,7 @@ async def list_assets(self,
paged results in response.
.. code-block::
.. code-block:: python
from google.cloud import asset_v1
Expand Down Expand Up @@ -422,7 +422,7 @@ async def batch_get_assets_history(self,
INVALID_ARGUMENT error.
.. code-block::
.. code-block:: python
from google.cloud import asset_v1
Expand Down Expand Up @@ -504,7 +504,7 @@ async def create_feed(self,
updates.
.. code-block::
.. code-block:: python
from google.cloud import asset_v1
Expand Down Expand Up @@ -614,7 +614,7 @@ async def get_feed(self,
) -> asset_service.Feed:
r"""Gets details about an asset feed.
.. code-block::
.. code-block:: python
from google.cloud import asset_v1
Expand Down Expand Up @@ -723,7 +723,7 @@ async def list_feeds(self,
project/folder/organization.
.. code-block::
.. code-block:: python
from google.cloud import asset_v1
Expand Down Expand Up @@ -825,7 +825,7 @@ async def update_feed(self,
) -> asset_service.Feed:
r"""Updates an asset feed configuration.
.. code-block::
.. code-block:: python
from google.cloud import asset_v1
Expand Down Expand Up @@ -929,7 +929,7 @@ async def delete_feed(self,
) -> None:
r"""Deletes an asset feed.
.. code-block::
.. code-block:: python
from google.cloud import asset_v1
Expand Down Expand Up @@ -1025,7 +1025,7 @@ async def search_all_resources(self,
desired scope, otherwise the request will be rejected.
.. code-block::
.. code-block:: python
from google.cloud import asset_v1
Expand Down Expand Up @@ -1232,7 +1232,7 @@ async def search_all_iam_policies(self,
desired scope, otherwise the request will be rejected.
.. code-block::
.. code-block:: python
from google.cloud import asset_v1
Expand Down Expand Up @@ -1415,7 +1415,7 @@ async def analyze_iam_policy(self,
what accesses on which resources.
.. code-block::
.. code-block:: python
from google.cloud import asset_v1
Expand Down Expand Up @@ -1510,7 +1510,7 @@ async def analyze_iam_policy_longrunning(self,
to help callers to map responses to requests.
.. code-block::
.. code-block:: python
from google.cloud import asset_v1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -407,8 +407,7 @@ def export_assets(self,
the export operation usually finishes within 5 minutes.
.. code-block::
.. code-block:: python
from google.cloud import asset_v1
Expand Down Expand Up @@ -506,8 +505,7 @@ def list_assets(self,
paged results in response.
.. code-block::
.. code-block:: python
from google.cloud import asset_v1
Expand Down Expand Up @@ -621,8 +619,7 @@ def batch_get_assets_history(self,
INVALID_ARGUMENT error.
.. code-block::
.. code-block:: python
from google.cloud import asset_v1
Expand Down Expand Up @@ -698,8 +695,7 @@ def create_feed(self,
updates.
.. code-block::
.. code-block:: python
from google.cloud import asset_v1
Expand Down Expand Up @@ -809,8 +805,7 @@ def get_feed(self,
) -> asset_service.Feed:
r"""Gets details about an asset feed.
.. code-block::
.. code-block:: python
from google.cloud import asset_v1
Expand Down Expand Up @@ -912,8 +907,7 @@ def list_feeds(self,
project/folder/organization.
.. code-block::
.. code-block:: python
from google.cloud import asset_v1
Expand Down Expand Up @@ -1008,8 +1002,7 @@ def update_feed(self,
) -> asset_service.Feed:
r"""Updates an asset feed configuration.
.. code-block::
.. code-block:: python
from google.cloud import asset_v1
Expand Down Expand Up @@ -1113,8 +1106,7 @@ def delete_feed(self,
) -> None:
r"""Deletes an asset feed.
.. code-block::
.. code-block:: python
from google.cloud import asset_v1
Expand Down Expand Up @@ -1203,8 +1195,7 @@ def search_all_resources(self,
desired scope, otherwise the request will be rejected.
.. code-block::
.. code-block:: python
from google.cloud import asset_v1
Expand Down Expand Up @@ -1404,8 +1395,7 @@ def search_all_iam_policies(self,
desired scope, otherwise the request will be rejected.
.. code-block::
.. code-block:: python
from google.cloud import asset_v1
Expand Down Expand Up @@ -1581,8 +1571,7 @@ def analyze_iam_policy(self,
what accesses on which resources.
.. code-block::
.. code-block:: python
from google.cloud import asset_v1
Expand Down Expand Up @@ -1672,8 +1661,7 @@ def analyze_iam_policy_longrunning(self,
to help callers to map responses to requests.
.. code-block::
.. code-block:: python
from google.cloud import asset_v1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ async def generate_access_token(self,
account.
.. code-block::
.. code-block:: python
from google.iam import credentials_v1
Expand Down Expand Up @@ -363,7 +363,7 @@ async def generate_id_token(self,
account.
.. code-block::
.. code-block:: python
from google.iam import credentials_v1
Expand Down Expand Up @@ -510,7 +510,7 @@ async def sign_blob(self,
private key.
.. code-block::
.. code-block:: python
from google.iam import credentials_v1
Expand Down Expand Up @@ -644,7 +644,7 @@ async def sign_jwt(self,
private key.
.. code-block::
.. code-block:: python
from google.iam import credentials_v1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -396,8 +396,7 @@ def generate_access_token(self,
account.
.. code-block::
.. code-block:: python
from google.iam import credentials_v1
Expand Down Expand Up @@ -544,8 +543,7 @@ def generate_id_token(self,
account.
.. code-block::
.. code-block:: python
from google.iam import credentials_v1
Expand Down Expand Up @@ -685,8 +683,7 @@ def sign_blob(self,
private key.
.. code-block::
.. code-block:: python
from google.iam import credentials_v1
Expand Down Expand Up @@ -813,8 +810,7 @@ def sign_jwt(self,
private key.
.. code-block::
.. code-block:: python
from google.iam import credentials_v1
Expand Down
Loading

0 comments on commit 500dfe7

Please sign in to comment.