From 62d1543e18040b286b23464562aa6eb998074c54 Mon Sep 17 00:00:00 2001 From: HemangChothani <50404902+HemangChothani@users.noreply.github.com> Date: Tue, 16 Jun 2020 04:42:10 +0530 Subject: [PATCH] docs(storage): fix indent in code blocks (#171) Fixes #170 --- google/cloud/storage/__init__.py | 1 + google/cloud/storage/acl.py | 5 +++++ google/cloud/storage/bucket.py | 8 ++++++++ google/cloud/storage/client.py | 4 ++++ 4 files changed, 18 insertions(+) diff --git a/google/cloud/storage/__init__.py b/google/cloud/storage/__init__.py index 2b643fc80..2a9629dfb 100644 --- a/google/cloud/storage/__init__.py +++ b/google/cloud/storage/__init__.py @@ -19,6 +19,7 @@ .. literalinclude:: snippets.py :start-after: [START storage_get_started] :end-before: [END storage_get_started] + :dedent: 4 The main concepts with this API are: diff --git a/google/cloud/storage/acl.py b/google/cloud/storage/acl.py index fb07faba9..765590f94 100644 --- a/google/cloud/storage/acl.py +++ b/google/cloud/storage/acl.py @@ -21,6 +21,7 @@ .. literalinclude:: snippets.py :start-after: [START client_bucket_acl] :end-before: [END client_bucket_acl] + :dedent: 4 Adding and removing permissions can be done with the following methods @@ -52,6 +53,7 @@ .. literalinclude:: snippets.py :start-after: [START acl_user_settings] :end-before: [END acl_user_settings] + :dedent: 4 After that, you can save any changes you make with the :func:`google.cloud.storage.acl.ACL.save` method: @@ -59,6 +61,7 @@ .. literalinclude:: snippets.py :start-after: [START acl_save] :end-before: [END acl_save] + :dedent: 4 You can alternatively save any existing :class:`google.cloud.storage.acl.ACL` object (whether it was created by a factory method or not) from a @@ -67,6 +70,7 @@ .. literalinclude:: snippets.py :start-after: [START acl_save_bucket] :end-before: [END acl_save_bucket] + :dedent: 4 To get the list of ``entity`` and ``role`` for each unique pair, the :class:`ACL` class is iterable: @@ -74,6 +78,7 @@ .. literalinclude:: snippets.py :start-after: [START acl_print] :end-before: [END acl_print] + :dedent: 4 This list of tuples can be used as the ``entity`` and ``role`` fields when sending metadata for ACLs to the API. diff --git a/google/cloud/storage/bucket.py b/google/cloud/storage/bucket.py index 2e88f5a84..c82226cc3 100644 --- a/google/cloud/storage/bucket.py +++ b/google/cloud/storage/bucket.py @@ -968,6 +968,7 @@ def get_blob( .. literalinclude:: snippets.py :start-after: [START get_blob] :end-before: [END get_blob] + :dedent: 4 If :attr:`user_project` is set, bills the API request to that project. @@ -1381,6 +1382,7 @@ def delete_blob( .. literalinclude:: snippets.py :start-after: [START delete_blob] :end-before: [END delete_blob] + :dedent: 4 If :attr:`user_project` is set, bills the API request to that project. @@ -1431,6 +1433,7 @@ def delete_blob( .. literalinclude:: snippets.py :start-after: [START delete_blobs] :end-before: [END delete_blobs] + :dedent: 4 """ client = self._require_client(client) @@ -2105,6 +2108,7 @@ def add_lifecycle_delete_rule(self, **kw): .. literalinclude:: snippets.py :start-after: [START add_lifecycle_delete_rule] :end-before: [END add_lifecycle_delete_rule] + :dedent: 4 :type kw: dict :params kw: arguments passed to :class:`LifecycleRuleConditions`. @@ -2122,6 +2126,7 @@ def add_lifecycle_set_storage_class_rule(self, storage_class, **kw): .. literalinclude:: snippets.py :start-after: [START add_lifecycle_set_storage_class_rule] :end-before: [END add_lifecycle_set_storage_class_rule] + :dedent: 4 :type storage_class: str, one of :attr:`STORAGE_CLASSES`. :param storage_class: new storage class to assign to matching items. @@ -2465,12 +2470,14 @@ def configure_website(self, main_page_suffix=None, not_found_page=None): .. literalinclude:: snippets.py :start-after: [START configure_website] :end-before: [END configure_website] + :dedent: 4 You probably should also make the whole bucket public: .. literalinclude:: snippets.py :start-after: [START make_public] :end-before: [END make_public] + :dedent: 4 This says: "Make the bucket public, and all the stuff already in the bucket, and anything else I add to the bucket. Just make it @@ -2804,6 +2811,7 @@ def generate_upload_policy(self, conditions, expiration=None, client=None): .. literalinclude:: snippets.py :start-after: [START policy_document] :end-before: [END policy_document] + :dedent: 4 .. _policy documents: https://cloud.google.com/storage/docs/xml-api\ diff --git a/google/cloud/storage/client.py b/google/cloud/storage/client.py index 4b23de04e..2fb7fb75c 100644 --- a/google/cloud/storage/client.py +++ b/google/cloud/storage/client.py @@ -329,6 +329,7 @@ def get_bucket( .. literalinclude:: snippets.py :start-after: [START get_bucket] :end-before: [END get_bucket] + :dedent: 4 Get a bucket using a resource. @@ -367,6 +368,7 @@ def lookup_bucket( .. literalinclude:: snippets.py :start-after: [START lookup_bucket] :end-before: [END lookup_bucket] + :dedent: 4 :type bucket_name: str :param bucket_name: The name of the bucket to get. @@ -461,6 +463,7 @@ def create_bucket( .. literalinclude:: snippets.py :start-after: [START create_bucket] :end-before: [END create_bucket] + :dedent: 4 Create a bucket using a resource. @@ -702,6 +705,7 @@ def list_buckets( .. literalinclude:: snippets.py :start-after: [START list_buckets] :end-before: [END list_buckets] + :dedent: 4 This implements "storage.buckets.list".