Navigation Menu

Skip to content

Commit

Permalink
docs: remove indent from snippet code blocks (#49)
Browse files Browse the repository at this point in the history
Co-authored-by: Tres Seaver <tseaver@palladion.com>
  • Loading branch information
HemangChothani and tseaver committed Aug 3, 2020
1 parent 9bb11ed commit 1fbadf9
Show file tree
Hide file tree
Showing 11 changed files with 100 additions and 6 deletions.
6 changes: 6 additions & 0 deletions google/cloud/bigtable/app_profile.py
Expand Up @@ -95,6 +95,7 @@ def name(self):
.. literalinclude:: snippets.py
:start-after: [START bigtable_app_profile_name]
:end-before: [END bigtable_app_profile_name]
:dedent: 4
The AppProfile name is of the form
``"projects/../instances/../app_profile/{app_profile_id}"``
Expand Down Expand Up @@ -238,6 +239,7 @@ def reload(self):
.. literalinclude:: snippets.py
:start-after: [START bigtable_reload_app_profile]
:end-before: [END bigtable_reload_app_profile]
:dedent: 4
"""

app_profile_pb = self.instance_admin_client.get_app_profile(self.name)
Expand All @@ -254,6 +256,7 @@ def exists(self):
.. literalinclude:: snippets.py
:start-after: [START bigtable_app_profile_exists]
:end-before: [END bigtable_app_profile_exists]
:dedent: 4
:rtype: bool
:returns: True if the AppProfile exists, else False.
Expand All @@ -280,6 +283,7 @@ def create(self, ignore_warnings=None):
.. literalinclude:: snippets.py
:start-after: [START bigtable_create_app_profile]
:end-before: [END bigtable_create_app_profile]
:dedent: 4
:type: ignore_warnings: bool
:param: ignore_warnings: (Optional) If true, ignore safety checks when
Expand Down Expand Up @@ -311,6 +315,7 @@ def update(self, ignore_warnings=None):
.. literalinclude:: snippets.py
:start-after: [START bigtable_update_app_profile]
:end-before: [END bigtable_update_app_profile]
:dedent: 4
"""
update_mask_pb = field_mask_pb2.FieldMask()

Expand All @@ -336,6 +341,7 @@ def delete(self, ignore_warnings=None):
.. literalinclude:: snippets.py
:start-after: [START bigtable_delete_app_profile]
:end-before: [END bigtable_delete_app_profile]
:dedent: 4
:type: ignore_warnings: bool
:param: ignore_warnings: If true, ignore safety checks when deleting
Expand Down
3 changes: 3 additions & 0 deletions google/cloud/bigtable/batcher.py
Expand Up @@ -73,6 +73,7 @@ def mutate(self, row):
.. literalinclude:: snippets.py
:start-after: [START bigtable_batcher_mutate]
:end-before: [END bigtable_batcher_mutate]
:dedent: 4
:type row: class
:param row: class:`~google.cloud.bigtable.row.DirectRow`.
Expand Down Expand Up @@ -112,6 +113,7 @@ def mutate_rows(self, rows):
.. literalinclude:: snippets.py
:start-after: [START bigtable_batcher_mutate_rows]
:end-before: [END bigtable_batcher_mutate_rows]
:dedent: 4
:type rows: list:[`~google.cloud.bigtable.row.DirectRow`]
:param rows: list:[`~google.cloud.bigtable.row.DirectRow`].
Expand All @@ -134,6 +136,7 @@ def flush(self):
.. literalinclude:: snippets.py
:start-after: [START bigtable_batcher_flush]
:end-before: [END bigtable_batcher_flush]
:dedent: 4
"""
if len(self.rows) != 0:
Expand Down
7 changes: 7 additions & 0 deletions google/cloud/bigtable/client.py
Expand Up @@ -206,6 +206,7 @@ def project_path(self):
.. literalinclude:: snippets.py
:start-after: [START bigtable_project_path]
:end-before: [END bigtable_project_path]
:dedent: 4
The project name is of the form
Expand All @@ -225,6 +226,7 @@ def table_data_client(self):
.. literalinclude:: snippets.py
:start-after: [START bigtable_table_data_client]
:end-before: [END bigtable_table_data_client]
:dedent: 4
:rtype: :class:`.bigtable_v2.BigtableClient`
:returns: A BigtableClient object.
Expand All @@ -245,6 +247,7 @@ def table_admin_client(self):
.. literalinclude:: snippets.py
:start-after: [START bigtable_table_admin_client]
:end-before: [END bigtable_table_admin_client]
:dedent: 4
:rtype: :class:`.bigtable_admin_pb2.BigtableTableAdmin`
:returns: A BigtableTableAdmin instance.
Expand All @@ -271,6 +274,7 @@ def instance_admin_client(self):
.. literalinclude:: snippets.py
:start-after: [START bigtable_instance_admin_client]
:end-before: [END bigtable_instance_admin_client]
:dedent: 4
:rtype: :class:`.bigtable_admin_pb2.BigtableInstanceAdmin`
:returns: A BigtableInstanceAdmin instance.
Expand All @@ -296,6 +300,7 @@ def instance(self, instance_id, display_name=None, instance_type=None, labels=No
.. literalinclude:: snippets.py
:start-after: [START bigtable_create_prod_instance]
:end-before: [END bigtable_create_prod_instance]
:dedent: 4
:type instance_id: str
:param instance_id: The ID of the instance.
Expand Down Expand Up @@ -345,6 +350,7 @@ def list_instances(self):
.. literalinclude:: snippets.py
:start-after: [START bigtable_list_instances]
:end-before: [END bigtable_list_instances]
:dedent: 4
:rtype: tuple
:returns:
Expand All @@ -365,6 +371,7 @@ def list_clusters(self):
.. literalinclude:: snippets.py
:start-after: [START bigtable_list_clusters_in_project]
:end-before: [END bigtable_list_clusters_in_project]
:dedent: 4
:rtype: tuple
:returns:
Expand Down
8 changes: 8 additions & 0 deletions google/cloud/bigtable/cluster.py
Expand Up @@ -99,6 +99,7 @@ def from_pb(cls, cluster_pb, instance):
.. literalinclude:: snippets.py
:start-after: [START bigtable_cluster_from_pb]
:end-before: [END bigtable_cluster_from_pb]
:dedent: 4
:type cluster_pb: :class:`instance_pb2.Cluster`
:param cluster_pb: An instance protobuf object.
Expand Down Expand Up @@ -159,6 +160,7 @@ def name(self):
.. literalinclude:: snippets.py
:start-after: [START bigtable_cluster_name]
:end-before: [END bigtable_cluster_name]
:dedent: 4
The cluster name is of the form
Expand All @@ -180,6 +182,7 @@ def state(self):
.. literalinclude:: snippets.py
:start-after: [START bigtable_cluster_state]
:end-before: [END bigtable_cluster_state]
:dedent: 4
"""
return self._state
Expand All @@ -206,6 +209,7 @@ def reload(self):
.. literalinclude:: snippets.py
:start-after: [START bigtable_reload_cluster]
:end-before: [END bigtable_reload_cluster]
:dedent: 4
"""
cluster_pb = self._instance._client.instance_admin_client.get_cluster(self.name)

Expand All @@ -221,6 +225,7 @@ def exists(self):
.. literalinclude:: snippets.py
:start-after: [START bigtable_check_cluster_exists]
:end-before: [END bigtable_check_cluster_exists]
:dedent: 4
:rtype: bool
:returns: True if the table exists, else False.
Expand All @@ -241,6 +246,7 @@ def create(self):
.. literalinclude:: snippets.py
:start-after: [START bigtable_create_cluster]
:end-before: [END bigtable_create_cluster]
:dedent: 4
.. note::
Expand Down Expand Up @@ -274,6 +280,7 @@ def update(self):
.. literalinclude:: snippets.py
:start-after: [START bigtable_update_cluster]
:end-before: [END bigtable_update_cluster]
:dedent: 4
.. note::
Expand Down Expand Up @@ -306,6 +313,7 @@ def delete(self):
.. literalinclude:: snippets.py
:start-after: [START bigtable_delete_cluster]
:end-before: [END bigtable_delete_cluster]
:dedent: 4
Marks a cluster and all of its tables for permanent deletion in 7 days.
Expand Down
8 changes: 8 additions & 0 deletions google/cloud/bigtable/column_family.py
Expand Up @@ -48,6 +48,7 @@ class MaxVersionsGCRule(GarbageCollectionRule):
.. literalinclude:: snippets_table.py
:start-after: [START bigtable_create_family_gc_max_versions]
:end-before: [END bigtable_create_family_gc_max_versions]
:dedent: 4
:type max_num_versions: int
:param max_num_versions: The maximum number of versions
Expand Down Expand Up @@ -81,6 +82,7 @@ class MaxAgeGCRule(GarbageCollectionRule):
.. literalinclude:: snippets_table.py
:start-after: [START bigtable_create_family_gc_max_age]
:end-before: [END bigtable_create_family_gc_max_age]
:dedent: 4
:type max_age: :class:`datetime.timedelta`
:param max_age: The maximum age allowed for a cell in the table.
Expand Down Expand Up @@ -115,6 +117,7 @@ class GCRuleUnion(GarbageCollectionRule):
.. literalinclude:: snippets_table.py
:start-after: [START bigtable_create_family_gc_union]
:end-before: [END bigtable_create_family_gc_union]
:dedent: 4
:type rules: list
:param rules: List of :class:`GarbageCollectionRule`.
Expand Down Expand Up @@ -149,6 +152,7 @@ class GCRuleIntersection(GarbageCollectionRule):
.. literalinclude:: snippets_table.py
:start-after: [START bigtable_create_family_gc_intersection]
:end-before: [END bigtable_create_family_gc_intersection]
:dedent: 4
:type rules: list
:param rules: List of :class:`GarbageCollectionRule`.
Expand Down Expand Up @@ -212,6 +216,7 @@ def name(self):
.. literalinclude:: snippets_table.py
:start-after: [START bigtable_column_family_name]
:end-before: [END bigtable_column_family_name]
:dedent: 4
.. note::
Expand Down Expand Up @@ -258,6 +263,7 @@ def create(self):
.. literalinclude:: snippets_table.py
:start-after: [START bigtable_create_column_family]
:end-before: [END bigtable_create_column_family]
:dedent: 4
"""
column_family = self.to_pb()
Expand All @@ -280,6 +286,7 @@ def update(self):
.. literalinclude:: snippets_table.py
:start-after: [START bigtable_update_column_family]
:end-before: [END bigtable_update_column_family]
:dedent: 4
.. note::
Expand All @@ -306,6 +313,7 @@ def delete(self):
.. literalinclude:: snippets_table.py
:start-after: [START bigtable_delete_column_family]
:end-before: [END bigtable_delete_column_family]
:dedent: 4
"""
modification = table_admin_v2_pb2.ModifyColumnFamiliesRequest.Modification(
Expand Down
17 changes: 17 additions & 0 deletions google/cloud/bigtable/instance.py
Expand Up @@ -134,6 +134,7 @@ def from_pb(cls, instance_pb, client):
.. literalinclude:: snippets.py
:start-after: [START bigtable_instance_from_pb]
:end-before: [END bigtable_instance_from_pb]
:dedent: 4
:type instance_pb: :class:`instance_pb2.Instance`
:param instance_pb: An instance protobuf object.
Expand Down Expand Up @@ -178,6 +179,7 @@ def name(self):
.. literalinclude:: snippets.py
:start-after: [START bigtable_instance_name]
:end-before: [END bigtable_instance_name]
:dedent: 4
The instance name is of the form
Expand All @@ -199,6 +201,7 @@ def state(self):
.. literalinclude:: snippets.py
:start-after: [START bigtable_instance_state]
:end-before: [END bigtable_instance_state]
:dedent: 4
"""
return self._state
Expand Down Expand Up @@ -231,6 +234,7 @@ def create(
.. literalinclude:: snippets.py
:start-after: [START bigtable_create_prod_instance]
:end-before: [END bigtable_create_prod_instance]
:dedent: 4
.. note::
Expand Down Expand Up @@ -331,6 +335,7 @@ def exists(self):
.. literalinclude:: snippets.py
:start-after: [START bigtable_check_instance_exists]
:end-before: [END bigtable_check_instance_exists]
:dedent: 4
:rtype: bool
:returns: True if the table exists, else False.
Expand All @@ -350,6 +355,7 @@ def reload(self):
.. literalinclude:: snippets.py
:start-after: [START bigtable_reload_instance]
:end-before: [END bigtable_reload_instance]
:dedent: 4
"""
instance_pb = self._client.instance_admin_client.get_instance(self.name)

Expand All @@ -365,6 +371,7 @@ def update(self):
.. literalinclude:: snippets.py
:start-after: [START bigtable_update_instance]
:end-before: [END bigtable_update_instance]
:dedent: 4
.. note::
Expand Down Expand Up @@ -411,6 +418,7 @@ def delete(self):
.. literalinclude:: snippets.py
:start-after: [START bigtable_delete_instance]
:end-before: [END bigtable_delete_instance]
:dedent: 4
Marks an instance and all of its tables for permanent deletion
in 7 days.
Expand Down Expand Up @@ -441,6 +449,7 @@ def get_iam_policy(self, requested_policy_version=None):
.. literalinclude:: snippets.py
:start-after: [START bigtable_get_iam_policy]
:end-before: [END bigtable_get_iam_policy]
:dedent: 4
:type requested_policy_version: int or ``NoneType``
:param requested_policy_version: Optional. The version of IAM policies to request.
Expand Down Expand Up @@ -480,6 +489,7 @@ class `google.cloud.bigtable.policy.Policy`
.. literalinclude:: snippets.py
:start-after: [START bigtable_set_iam_policy]
:end-before: [END bigtable_set_iam_policy]
:dedent: 4
:type policy: :class:`google.cloud.bigtable.policy.Policy`
:param policy: A new IAM policy to replace the current IAM policy
Expand All @@ -503,6 +513,7 @@ def test_iam_permissions(self, permissions):
.. literalinclude:: snippets.py
:start-after: [START bigtable_test_iam_permissions]
:end-before: [END bigtable_test_iam_permissions]
:dedent: 4
:type permissions: list
:param permissions: The set of permissions to check for
Expand Down Expand Up @@ -532,6 +543,7 @@ def cluster(
.. literalinclude:: snippets.py
:start-after: [START bigtable_create_cluster]
:end-before: [END bigtable_create_cluster]
:dedent: 4
:type cluster_id: str
:param cluster_id: The ID of the cluster.
Expand Down Expand Up @@ -575,6 +587,7 @@ def list_clusters(self):
.. literalinclude:: snippets.py
:start-after: [START bigtable_list_clusters_on_instance]
:end-before: [END bigtable_list_clusters_on_instance]
:dedent: 4
:rtype: tuple
:returns:
Expand All @@ -595,6 +608,7 @@ def table(self, table_id, mutation_timeout=None, app_profile_id=None):
.. literalinclude:: snippets.py
:start-after: [START bigtable_create_table]
:end-before: [END bigtable_create_table]
:dedent: 4
:type table_id: str
:param table_id: The ID of the table.
Expand All @@ -620,6 +634,7 @@ def list_tables(self):
.. literalinclude:: snippets.py
:start-after: [START bigtable_list_tables]
:end-before: [END bigtable_list_tables]
:dedent: 4
:rtype: list of :class:`Table <google.cloud.bigtable.table.Table>`
:returns: The list of tables owned by the instance.
Expand Down Expand Up @@ -655,6 +670,7 @@ def app_profile(
.. literalinclude:: snippets.py
:start-after: [START bigtable_create_app_profile]
:end-before: [END bigtable_create_app_profile]
:dedent: 4
:type app_profile_id: str
:param app_profile_id: The ID of the AppProfile. Must be of the form
Expand Down Expand Up @@ -701,6 +717,7 @@ def list_app_profiles(self):
.. literalinclude:: snippets.py
:start-after: [START bigtable_list_app_profiles]
:end-before: [END bigtable_list_app_profiles]
:dedent: 4
:rtype: :list:[`~google.cloud.bigtable.app_profile.AppProfile`]
:returns: A :list:[`~google.cloud.bigtable.app_profile.AppProfile`].
Expand Down

0 comments on commit 1fbadf9

Please sign in to comment.