From 8ffc438d6939be8fee5b9d560c1c812ec04486e1 Mon Sep 17 00:00:00 2001 From: Danny Hermes Date: Mon, 5 Jun 2017 12:40:16 -0700 Subject: [PATCH] Revert "Fix "broken" docs build. (#3422)" (#3439) This reverts commit a849060a505d5b891b68df679ac36ee79f1e9414. --- docs/logging/usage.rst | 32 ++++++++++++++++++++++++++++ nox.py | 2 +- pubsub/google/cloud/pubsub/client.py | 2 ++ storage/google/cloud/storage/blob.py | 2 ++ 4 files changed, 37 insertions(+), 1 deletion(-) diff --git a/docs/logging/usage.rst b/docs/logging/usage.rst index 5ec64aa90598..4ffc5998225f 100644 --- a/docs/logging/usage.rst +++ b/docs/logging/usage.rst @@ -41,12 +41,14 @@ Authentication and Configuration .. literalinclude:: snippets.py :start-after: [START client_create_default] :end-before: [END client_create_default] + :dedent: 4 or pass in ``credentials`` and ``project`` explicitly .. literalinclude:: snippets.py :start-after: [START client_create_explicit] :end-before: [END client_create_explicit] + :dedent: 4 Writing log entries @@ -59,18 +61,21 @@ which to associate the entries: .. literalinclude:: snippets.py :start-after: [START logger_create] :end-before: [END logger_create] + :dedent: 4 Write a simple text entry to the logger. .. literalinclude:: snippets.py :start-after: [START logger_log_text] :end-before: [END logger_log_text] + :dedent: 4 Write a dictionary entry to the logger. .. literalinclude:: snippets.py :start-after: [START logger_log_struct] :end-before: [END logger_log_struct] + :dedent: 4 Retrieving log entries @@ -81,12 +86,14 @@ Fetch entries for the default project. .. literalinclude:: snippets.py :start-after: [START client_list_entries_default] :end-before: [END client_list_entries_default] + :dedent: 4 Fetch entries across multiple projects. .. literalinclude:: snippets.py :start-after: [START client_list_entries_multi_project] :end-before: [END client_list_entries_multi_project] + :dedent: 4 Filter entries retrieved using the `Advanced Logs Filters`_ syntax @@ -97,24 +104,28 @@ Fetch entries for the default project. .. literalinclude:: snippets.py :start-after: [START client_list_entries_filter] :end-before: [END client_list_entries_filter] + :dedent: 4 Sort entries in descending timestamp order. .. literalinclude:: snippets.py :start-after: [START client_list_entries_order_by] :end-before: [END client_list_entries_order_by] + :dedent: 4 Retrieve entries in batches of 10, iterating until done. .. literalinclude:: snippets.py :start-after: [START client_list_entries_paged] :end-before: [END client_list_entries_paged] + :dedent: 4 Retrieve entries for a single logger, sorting in descending timestamp order: .. literalinclude:: snippets.py :start-after: [START logger_list_entries] :end-before: [END logger_list_entries] + :dedent: 4 Delete all entries for a logger @@ -123,6 +134,7 @@ Delete all entries for a logger .. literalinclude:: snippets.py :start-after: [START logger_delete] :end-before: [END logger_delete] + :dedent: 8 Manage log metrics @@ -136,30 +148,35 @@ List all metrics for a project: .. literalinclude:: snippets.py :start-after: [START client_list_metrics] :end-before: [END client_list_metrics] + :dedent: 4 Create a metric: .. literalinclude:: snippets.py :start-after: [START metric_create] :end-before: [END metric_create] + :dedent: 4 Refresh local information about a metric: .. literalinclude:: snippets.py :start-after: [START metric_reload] :end-before: [END metric_reload] + :dedent: 4 Update a metric: .. literalinclude:: snippets.py :start-after: [START metric_update] :end-before: [END metric_update] + :dedent: 4 Delete a metric: .. literalinclude:: snippets.py :start-after: [START metric_delete] :end-before: [END metric_delete] + :dedent: 4 Export log entries using sinks ------------------------------ @@ -181,12 +198,14 @@ Add ``cloud-logs@google.com`` as the owner of the bucket: .. literalinclude:: snippets.py :start-after: [START sink_bucket_permissions] :end-before: [END sink_bucket_permissions] + :dedent: 4 Create a Cloud Storage sink: .. literalinclude:: snippets.py :start-after: [START sink_storage_create] :end-before: [END sink_storage_create] + :dedent: 4 Export to BigQuery @@ -202,12 +221,14 @@ See: `Setting permissions for BigQuery`_ .. literalinclude:: snippets.py :start-after: [START sink_dataset_permissions] :end-before: [END sink_dataset_permissions] + :dedent: 4 Create a BigQuery sink: .. literalinclude:: snippets.py :start-after: [START sink_bigquery_create] :end-before: [END sink_bigquery_create] + :dedent: 4 Export to Pub/Sub @@ -223,12 +244,14 @@ See: `Setting permissions for Pub/Sub`_ .. literalinclude:: snippets.py :start-after: [START sink_topic_permissions] :end-before: [END sink_topic_permissions] + :dedent: 4 Create a Cloud Pub/Sub sink: .. literalinclude:: snippets.py :start-after: [START sink_pubsub_create] :end-before: [END sink_pubsub_create] + :dedent: 4 Manage Sinks ~~~~~~~~~~~~ @@ -238,24 +261,28 @@ List all sinks for a project: .. literalinclude:: snippets.py :start-after: [START client_list_sinks] :end-before: [END client_list_sinks] + :dedent: 4 Refresh local information about a sink: .. literalinclude:: snippets.py :start-after: [START sink_reload] :end-before: [END sink_reload] + :dedent: 4 Update a sink: .. literalinclude:: snippets.py :start-after: [START sink_update] :end-before: [END sink_update] + :dedent: 4 Delete a sink: .. literalinclude:: snippets.py :start-after: [START sink_delete] :end-before: [END sink_delete] + :dedent: 4 Integration with Python logging module -------------------------------------- @@ -268,6 +295,7 @@ To automatically pick the default for your current environment, use .. literalinclude:: snippets.py :start-after: [START create_default_handler] :end-before: [END create_default_handler] + :dedent: 4 It is also possible to attach the handler to the root Python logger, so that for example a plain ``logging.warn`` call would be sent to Stackdriver Logging, @@ -278,6 +306,7 @@ to configure this automatically. .. literalinclude:: snippets.py :start-after: [START setup_logging] :end-before: [END setup_logging] + :dedent: 4 .. note:: @@ -289,6 +318,7 @@ You can also exclude certain loggers: .. literalinclude:: snippets.py :start-after: [START setup_logging_excludes] :end-before: [END setup_logging_excludes] + :dedent: 4 Cloud Logging Handler ~~~~~~~~~~~~~~~~~~~~~ @@ -302,6 +332,7 @@ which will write directly to the API. .. literalinclude:: snippets.py :start-after: [START create_cloud_handler] :end-before: [END create_cloud_handler] + :dedent: 4 .. note:: @@ -317,6 +348,7 @@ of the Python logger will be included in the structured log entry under the .. literalinclude:: snippets.py :start-after: [START create_named_handler] :end-before: [END create_named_handler] + :dedent: 4 Cloud Logging Handler transports ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/nox.py b/nox.py index ba3de939901a..dd38837e6a01 100644 --- a/nox.py +++ b/nox.py @@ -26,7 +26,7 @@ def docs(session): # Install Sphinx and also all of the google-cloud-* packages. session.chdir(os.path.realpath(os.path.dirname(__file__))) - session.install('sphinx', 'sphinx_rtd_theme') + session.install('Sphinx >= 1.6.2', 'sphinx_rtd_theme') session.install( 'core/', 'bigquery/', 'bigtable/', 'datastore/', 'dns/', 'language/', 'logging/', 'error_reporting/', 'monitoring/', 'pubsub/', diff --git a/pubsub/google/cloud/pubsub/client.py b/pubsub/google/cloud/pubsub/client.py index 902188beaab6..6a7e60a1923d 100644 --- a/pubsub/google/cloud/pubsub/client.py +++ b/pubsub/google/cloud/pubsub/client.py @@ -226,6 +226,7 @@ def topic(self, name, timestamp_messages=False): .. literalinclude:: snippets.py :start-after: [START client_topic] :end-before: [END client_topic] + :dedent: 4 :type name: str :param name: the name of the topic to be constructed. @@ -248,6 +249,7 @@ def subscription(self, name, ack_deadline=None, push_endpoint=None, .. literalinclude:: snippets.py :start-after: [START client_subscription] :end-before: [END client_subscription] + :dedent: 4 :type name: str :param name: the name of the subscription to be constructed. diff --git a/storage/google/cloud/storage/blob.py b/storage/google/cloud/storage/blob.py index 8805cd734229..de59fdf1f2bd 100644 --- a/storage/google/cloud/storage/blob.py +++ b/storage/google/cloud/storage/blob.py @@ -442,6 +442,7 @@ def download_to_file(self, file_obj, client=None): .. literalinclude:: snippets.py :start-after: [START download_to_file] :end-before: [END download_to_file] + :dedent: 4 The ``encryption_key`` should be a str or bytes with a length of at least 32. @@ -843,6 +844,7 @@ def upload_from_file(self, file_obj, rewind=False, size=None, .. literalinclude:: snippets.py :start-after: [START upload_from_file] :end-before: [END upload_from_file] + :dedent: 4 The ``encryption_key`` should be a str or bytes with a length of at least 32.