Skip to content

Commit

Permalink
Fixup docstrings
Browse files Browse the repository at this point in the history
  • Loading branch information
theacodes committed Sep 14, 2018
1 parent 4a1722b commit 25884f6
Show file tree
Hide file tree
Showing 4 changed files with 68 additions and 40 deletions.
2 changes: 2 additions & 0 deletions redis/docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,7 @@ Api Reference
.. toctree::
:maxdepth: 2

gapic/v1/api
gapic/v1/types
gapic/v1beta1/api
gapic/v1beta1/types
29 changes: 6 additions & 23 deletions redis/google/cloud/redis_v1/gapic/cloud_redis_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ class CloudRedisClient(object):
* Each project has a collection of available locations, named: ``/locations/*``
* Each location has a collection of Redis instances, named: ``/instances/*``
* As such, Redis instances are resources of the form:
``/projects/{project_id}/locations/{location_id}/instances/{instance_id}``
Note that location_id must be refering to a GCP ``region``; for example:
Expand Down Expand Up @@ -235,10 +236,7 @@ def list_instances(self,
... pass
Args:
parent (str): Required. The resource name of the instance location using the form:
::
`projects/{project_id}/locations/{location_id}`
parent (str): Required. The resource name of the instance location using the form ``projects/{project_id}/locations/{location_id}``
where ``location_id`` refers to a GCP region
page_size (int): The maximum number of resources contained in the
underlying API response. If page streaming is performed per-
Expand Down Expand Up @@ -314,10 +312,7 @@ def get_instance(self,
>>> response = client.get_instance(name)
Args:
name (str): Required. Redis instance resource name using the form:
::
`projects/{project_id}/locations/{location_id}/instances/{instance_id}`
name (str): Required. Redis instance resource name using the form ``projects/{project_id}/locations/{location_id}/instances/{instance_id}```
where ``location_id`` refers to a GCP region
retry (Optional[google.api_core.retry.Retry]): A retry object used
to retry requests. If ``None`` is specified, requests will not
Expand Down Expand Up @@ -398,14 +393,10 @@ def create_instance(self,
>>> metadata = response.metadata()
Args:
parent (str): Required. The resource name of the instance location using the form:
::
`projects/{project_id}/locations/{location_id}`
parent (str): Required. The resource name of the instance location using the form ``projects/{project_id}/locations/{location_id}``
where ``location_id`` refers to a GCP region
instance_id (str): Required. The logical name of the Redis instance in the customer project
with the following restrictions:
* Must contain only lowercase letters, numbers, and hyphens.
* Must start with a letter.
* Must be between 1-40 characters.
Expand Down Expand Up @@ -498,12 +489,7 @@ def update_instance(self,
Args:
update_mask (Union[dict, ~google.cloud.redis_v1.types.FieldMask]): Required. Mask of fields to update. At least one path must be supplied in
this field. The elements of the repeated paths field may only include these
fields from ``Instance``:
* ``displayName``
* ``labels``
* ``memorySizeGb``
* ``redisConfig``
fields from ``Instance``: ``displayName``, ``labels``, ``memorySizeGb``, and ``redisConfig``.
If a dict is provided, it must be of the same form as the protobuf
message :class:`~google.cloud.redis_v1.types.FieldMask`
instance (Union[dict, ~google.cloud.redis_v1.types.Instance]): Required. Update description.
Expand Down Expand Up @@ -581,10 +567,7 @@ def delete_instance(self,
>>> metadata = response.metadata()
Args:
name (str): Required. Redis instance resource name using the form:
::
`projects/{project_id}/locations/{location_id}/instances/{instance_id}`
name (str): Required. Redis instance resource name using the form ``projects/{project_id}/locations/{location_id}/instances/{instance_id}```
where ``location_id`` refers to a GCP region
retry (Optional[google.api_core.retry.Retry]): A retry object used
to retry requests. If ``None`` is specified, requests will not
Expand Down
22 changes: 5 additions & 17 deletions redis/google/cloud/redis_v1beta1/gapic/cloud_redis_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ class CloudRedisClient(object):
* Each project has a collection of available locations, named: ``/locations/*``
* Each location has a collection of Redis instances, named: ``/instances/*``
* As such, Redis instances are resources of the form:
``/projects/{project_id}/locations/{location_id}/instances/{instance_id}``
Note that location_id must be refering to a GCP ``region``; for example:
Expand Down Expand Up @@ -236,10 +237,7 @@ def list_instances(self,
... pass
Args:
parent (str): Required. The resource name of the instance location using the form:
::
`projects/{project_id}/locations/{location_id}`
parent (str): Required. The resource name of the instance location using the form ``projects/{project_id}/locations/{location_id}``
where ``location_id`` refers to a GCP region
page_size (int): The maximum number of resources contained in the
underlying API response. If page streaming is performed per-
Expand Down Expand Up @@ -315,10 +313,7 @@ def get_instance(self,
>>> response = client.get_instance(name)
Args:
name (str): Required. Redis instance resource name using the form:
::
`projects/{project_id}/locations/{location_id}/instances/{instance_id}`
name (str): Required. Redis instance resource name using the form ``projects/{project_id}/locations/{location_id}/instances/{instance_id}```
where ``location_id`` refers to a GCP region
retry (Optional[google.api_core.retry.Retry]): A retry object used
to retry requests. If ``None`` is specified, requests will not
Expand Down Expand Up @@ -399,14 +394,10 @@ def create_instance(self,
>>> metadata = response.metadata()
Args:
parent (str): Required. The resource name of the instance location using the form:
::
`projects/{project_id}/locations/{location_id}`
parent (str): Required. The resource name of the instance location using the form ``projects/{project_id}/locations/{location_id}``
where ``location_id`` refers to a GCP region
instance_id (str): Required. The logical name of the Redis instance in the customer project
with the following restrictions:
* Must contain only lowercase letters, numbers, and hyphens.
* Must start with a letter.
* Must be between 1-40 characters.
Expand Down Expand Up @@ -581,10 +572,7 @@ def delete_instance(self,
>>> metadata = response.metadata()
Args:
name (str): Required. Redis instance resource name using the form:
::
`projects/{project_id}/locations/{location_id}/instances/{instance_id}`
name (str): Required. Redis instance resource name using the form ``projects/{project_id}/locations/{location_id}/instances/{instance_id}```
where ``location_id`` refers to a GCP region
retry (Optional[google.api_core.retry.Retry]): A retry object used
to retry requests. If ``None`` is specified, requests will not
Expand Down
55 changes: 55 additions & 0 deletions redis/synth.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,61 @@
s.copy(library, excludes=excludes)


# Fix docstrings
s.replace(
'google/cloud/**/cloud_redis_client.py',
r'resources of the form:\n ``',
r'resources of the form:\n\n ``',)

s.replace(
'google/cloud/**/cloud_redis_client.py',
r"""
parent \(str\): Required. The resource name of the instance location using the form:
::
`projects/{project_id}/locations/{location_id}`
where ``location_id`` refers to a GCP region""",

r"""
parent (str): Required. The resource name of the instance location using the form ``projects/{project_id}/locations/{location_id}``
where ``location_id`` refers to a GCP region""",)


s.replace(
'google/cloud/**/cloud_redis_client.py',
r"""
with the following restrictions:
\* Must contain only lowercase letters, numbers, and hyphens\.""",
r"""
with the following restrictions:
* Must contain only lowercase letters, numbers, and hyphens.""")

s.replace(
'google/cloud/**/cloud_redis_client.py',
r"""
name \(str\): Required. Redis instance resource name using the form:
::
`projects/{project_id}/locations/{location_id}/instances/{instance_id}`
where ``location_id`` refers to a GCP region""",
r"""
name (str): Required. Redis instance resource name using the form ``projects/{project_id}/locations/{location_id}/instances/{instance_id}```
where ``location_id`` refers to a GCP region""")

s.replace(
'google/cloud/**/cloud_redis_client.py',
r"""
fields from ``Instance``:
\* ``displayName``
\* ``labels``
\* ``memorySizeGb``
\* ``redisConfig``""",

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

# Set Release Status
release_status = 'Development Status :: 3 - Alpha'
s.replace('setup.py',
Expand Down

0 comments on commit 25884f6

Please sign in to comment.