From ec781b6e8afc0b27599ddc69848571e1abf412ff Mon Sep 17 00:00:00 2001 From: Tim Swast Date: Fri, 21 Oct 2016 09:51:22 -0700 Subject: [PATCH] Remove None from param types and add (Optional). This runs a script to remove None from the types for parameters, and added (Optional) to the description. Does not pass lint due to some too-long lines. I will clean those up manually. See: https://github.com/GoogleCloudPlatform/google-cloud-python/pull/2580#pullrequestreview-5178193 --- bigquery/google/cloud/bigquery/dataset.py | 16 ++--- bigquery/google/cloud/bigquery/query.py | 16 ++--- bigquery/google/cloud/bigquery/table.py | 63 ++++++++--------- core/google/cloud/_helpers.py | 8 +-- core/google/cloud/connection.py | 12 ++-- .../google/cloud/streaming/buffered_stream.py | 4 +- core/google/cloud/streaming/http_wrapper.py | 8 +-- core/google/cloud/streaming/stream_slice.py | 4 +- core/google/cloud/streaming/transfer.py | 40 +++++------ .../google/cloud/datastore/connection.py | 4 +- datastore/google/cloud/datastore/key.py | 4 +- datastore/google/cloud/datastore/query.py | 12 ++-- dns/google/cloud/dns/changes.py | 16 ++--- dns/google/cloud/dns/client.py | 8 +-- dns/google/cloud/dns/zone.py | 44 ++++++------ logging/google/cloud/logging/client.py | 4 +- logging/google/cloud/logging/entries.py | 14 ++-- logging/google/cloud/logging/logger.py | 68 +++++++++---------- .../google/cloud/monitoring/_dataframe.py | 4 +- monitoring/google/cloud/monitoring/client.py | 32 ++++----- monitoring/google/cloud/monitoring/group.py | 44 ++++++------ monitoring/google/cloud/monitoring/metric.py | 12 ++-- monitoring/google/cloud/monitoring/query.py | 24 +++---- .../google/cloud/monitoring/resource.py | 4 +- .../google/cloud/monitoring/timeseries.py | 4 +- pubsub/google/cloud/pubsub/_gax.py | 12 ++-- pubsub/google/cloud/pubsub/connection.py | 12 ++-- pubsub/google/cloud/pubsub/message.py | 8 +-- pubsub/google/cloud/pubsub/subscription.py | 8 +-- scripts/run_pylint.py | 2 +- storage/google/cloud/storage/acl.py | 4 +- storage/google/cloud/storage/batch.py | 8 +-- storage/google/cloud/storage/blob.py | 12 ++-- storage/google/cloud/storage/client.py | 14 ++-- 34 files changed, 275 insertions(+), 274 deletions(-) diff --git a/bigquery/google/cloud/bigquery/dataset.py b/bigquery/google/cloud/bigquery/dataset.py index af0740d1feb0..423484c68d51 100644 --- a/bigquery/google/cloud/bigquery/dataset.py +++ b/bigquery/google/cloud/bigquery/dataset.py @@ -216,8 +216,8 @@ def default_table_expiration_ms(self): def default_table_expiration_ms(self, value): """Update default expiration time for tables in the dataset. - :type value: int, or ``NoneType`` - :param value: new default time, in milliseconds + :type value: int + :param value: (Optional) new default time, in milliseconds :raises: ValueError for invalid value types. """ @@ -238,8 +238,8 @@ def description(self): def description(self, value): """Update description of the dataset. - :type value: str, or ``NoneType`` - :param value: new description + :type value: str + :param value: (Optional) new description :raises: ValueError for invalid value types. """ @@ -260,8 +260,8 @@ def friendly_name(self): def friendly_name(self, value): """Update title of the dataset. - :type value: str, or ``NoneType`` - :param value: new title + :type value: str + :param value: (Optional) new title :raises: ValueError for invalid value types. """ @@ -282,8 +282,8 @@ def location(self): def location(self, value): """Update location in which the dataset is hosted. - :type value: str, or ``NoneType`` - :param value: new location + :type value: str + :param value: (Optional) new location :raises: ValueError for invalid value types. """ diff --git a/bigquery/google/cloud/bigquery/query.py b/bigquery/google/cloud/bigquery/query.py index 97e89c7cb5d8..3fe75b290b0c 100644 --- a/bigquery/google/cloud/bigquery/query.py +++ b/bigquery/google/cloud/bigquery/query.py @@ -345,17 +345,17 @@ def fetch_data(self, max_results=None, page_token=None, start_index=None, See: https://cloud.google.com/bigquery/docs/reference/v2/jobs/getQueryResults - :type max_results: int or ``NoneType`` - :param max_results: maximum number of rows to return. + :type max_results: int + :param max_results: (Optional) maximum number of rows to return. - :type page_token: str or ``NoneType`` - :param page_token: token representing a cursor into the table's rows. + :type page_token: str + :param page_token: (Optional) token representing a cursor into the table's rows. - :type start_index: int or ``NoneType`` - :param start_index: zero-based index of starting row + :type start_index: int + :param start_index: (Optional) zero-based index of starting row - :type timeout_ms: int or ``NoneType`` - :param timeout_ms: timeout, in milliseconds, to wait for query to + :type timeout_ms: int + :param timeout_ms: (Optional) timeout, in milliseconds, to wait for query to complete :type client: :class:`~google.cloud.bigquery.client.Client` or diff --git a/bigquery/google/cloud/bigquery/table.py b/bigquery/google/cloud/bigquery/table.py index 6afea05f9f26..ce04fc036b7d 100644 --- a/bigquery/google/cloud/bigquery/table.py +++ b/bigquery/google/cloud/bigquery/table.py @@ -264,8 +264,8 @@ def description(self): def description(self, value): """Update description of the table. - :type value: str, or ``NoneType`` - :param value: new description + :type value: str + :param value: (Optional) new description :raises: ValueError for invalid value types. """ @@ -289,8 +289,8 @@ def expires(self): def expires(self, value): """Update datetime at which the table will be removed. - :type value: ``datetime.datetime``, or ``NoneType`` - :param value: the new expiration time, or None + :type value: ``datetime.datetime`` + :param value: (Optional) the new expiration time, or None """ if not isinstance(value, datetime.datetime) and value is not None: raise ValueError("Pass a datetime, or None") @@ -309,8 +309,8 @@ def friendly_name(self): def friendly_name(self, value): """Update title of the table. - :type value: str, or ``NoneType`` - :param value: new title + :type value: str + :param value: (Optional) new title :raises: ValueError for invalid value types. """ @@ -331,8 +331,8 @@ def location(self): def location(self, value): """Update location in which the table is hosted. - :type value: str, or ``NoneType`` - :param value: new location + :type value: str + :param value: (Optional) new location :raises: ValueError for invalid value types. """ @@ -554,17 +554,17 @@ def patch(self, :param client: the client to use. If not passed, falls back to the ``client`` stored on the current dataset. - :type friendly_name: str or ``NoneType`` - :param friendly_name: point in time at which the table expires. + :type friendly_name: str + :param friendly_name: (Optional) point in time at which the table expires. - :type description: str or ``NoneType`` - :param description: point in time at which the table expires. + :type description: str + :param description: (Optional) point in time at which the table expires. - :type location: str or ``NoneType`` - :param location: point in time at which the table expires. + :type location: str + :param location: (Optional) point in time at which the table expires. - :type expires: :class:`datetime.datetime` or ``NoneType`` - :param expires: point in time at which the table expires. + :type expires: :class:`datetime.datetime` + :param expires: (Optional) point in time at which the table expires. :type view_query: str :param view_query: SQL query defining the table as a view @@ -654,11 +654,12 @@ def fetch_data(self, max_results=None, page_token=None, client=None): incomplete. To ensure that the local copy of the schema is up-to-date, call the table's ``reload`` method. - :type max_results: int or ``NoneType`` - :param max_results: maximum number of rows to return. + :type max_results: int + :param max_results: (Optional) maximum number of rows to return. - :type page_token: str or ``NoneType`` - :param page_token: token representing a cursor into the table's rows. + :type page_token: str + :param page_token: + (Optional) token representing a cursor into the table's rows. :type client: :class:`~google.cloud.bigquery.client.Client` or ``NoneType`` @@ -714,18 +715,18 @@ def insert_data(self, :param row_ids: Unique ids, one per row being inserted. If not passed, no de-duplication occurs. - :type skip_invalid_rows: bool or ``NoneType`` - :param skip_invalid_rows: skip rows w/ invalid data? + :type skip_invalid_rows: bool + :param skip_invalid_rows: (Optional) skip rows w/ invalid data? - :type ignore_unknown_values: bool or ``NoneType`` - :param ignore_unknown_values: ignore columns beyond schema? - - :type template_suffix: str or ``NoneType`` - :param template_suffix: treat ``name`` as a template table and provide - a suffix. BigQuery will create the table - `` + `` based on the - schema of the template table. See: - https://cloud.google.com/bigquery/streaming-data-into-bigquery#template-tables + :type ignore_unknown_values: bool + :param ignore_unknown_values: (Optional) ignore columns beyond schema? + + :type template_suffix: str + :param template_suffix: + (Optional) treat ``name`` as a template table and provide a suffix. + BigQuery will create the table `` + `` based + on the schema of the template table. See: + https://cloud.google.com/bigquery/streaming-data-into-bigquery#template-tables :type client: :class:`~google.cloud.bigquery.client.Client` or ``NoneType`` diff --git a/core/google/cloud/_helpers.py b/core/google/cloud/_helpers.py index 1e5fd3ab9b68..449961126a69 100644 --- a/core/google/cloud/_helpers.py +++ b/core/google/cloud/_helpers.py @@ -366,8 +366,8 @@ def _microseconds_from_datetime(value): def _millis_from_datetime(value): """Convert non-none datetime to timestamp, assuming UTC. - :type value: :class:`datetime.datetime`, or None - :param value: the timestamp + :type value: :class:`datetime.datetime` + :param value: (Optional) the timestamp :rtype: int, or ``NoneType`` :returns: the timestamp, in milliseconds, or None @@ -554,8 +554,8 @@ def _name_from_project_path(path, project, template): :type path: str :param path: URI path containing the name. - :type project: str or NoneType - :param project: The project associated with the request. It is + :type project: str + :param project: (Optional) The project associated with the request. It is included for validation purposes. If passed as None, disables validation. diff --git a/core/google/cloud/connection.py b/core/google/cloud/connection.py index 02f6b8f24f6b..a5eb2a7a6dd3 100644 --- a/core/google/cloud/connection.py +++ b/core/google/cloud/connection.py @@ -214,8 +214,8 @@ def _make_request(self, method, url, data=None, content_type=None, :type headers: dict :param headers: A dictionary of HTTP headers to send with the request. - :type target_object: object or :class:`NoneType` - :param target_object: Argument to be used by library callers. + :type target_object: object + :param target_object: (Optional) Argument to be used by library callers. This can allow custom behavior, for example, to defer an HTTP request and complete initialization of the object at a later time. @@ -261,8 +261,8 @@ def _do_request(self, method, url, headers, data, :type data: str :param data: The data to send as the body of the request. - :type target_object: object or :class:`NoneType` - :param target_object: Unused ``target_object`` here but may be used + :type target_object: object + :param target_object: (Optional) Unused ``target_object`` here but may be used by a superclass. :rtype: tuple of ``response`` (a dictionary of sorts) @@ -323,8 +323,8 @@ def api_request(self, method, path, query_params=None, response as JSON and raise an exception if that cannot be done. Default is True. - :type _target_object: :class:`object` or :class:`NoneType` - :param _target_object: Protected argument to be used by library + :type _target_object: :class:`object` + :param _target_object: (Optional) Protected argument to be used by library callers. This can allow custom behavior, for example, to defer an HTTP request and complete initialization of the object at a later time. diff --git a/core/google/cloud/streaming/buffered_stream.py b/core/google/cloud/streaming/buffered_stream.py index 748aa2068052..83061ade78a6 100644 --- a/core/google/cloud/streaming/buffered_stream.py +++ b/core/google/cloud/streaming/buffered_stream.py @@ -81,8 +81,8 @@ def _bytes_remaining(self): def read(self, size=None): """Read bytes from the buffer. - :type size: int or None - :param size: How many bytes to read (defaults to all remaining bytes). + :type size: int + :param size: (Optional) How many bytes to read (defaults to all remaining bytes). :rtype: str :returns: The data read from the stream. diff --git a/core/google/cloud/streaming/http_wrapper.py b/core/google/cloud/streaming/http_wrapper.py index 898d1b09029e..d6e58a4f4bf7 100644 --- a/core/google/cloud/streaming/http_wrapper.py +++ b/core/google/cloud/streaming/http_wrapper.py @@ -80,8 +80,8 @@ def _httplib2_debug_level(http_request, level, http=None): :type level: int :param level: the debuglevel for logging. - :type http: :class:`httplib2.Http`, or ``None`` - :param http: the instance on whose connections to set the debuglevel. + :type http: :class:`httplib2.Http` + :param http: (Optional) the instance on whose connections to set the debuglevel. """ if http_request.loggable_body is None: yield @@ -115,8 +115,8 @@ class Request(object): :type http_method: str :param http_method: the HTTP method to use for the request - :type headers: mapping or None - :param headers: headers to be sent with the request + :type headers: mapping + :param headers: (Optional) headers to be sent with the request :type body: str :param body: body to be sent with the request diff --git a/core/google/cloud/streaming/stream_slice.py b/core/google/cloud/streaming/stream_slice.py index bb37a4446ad5..c33cda011738 100644 --- a/core/google/cloud/streaming/stream_slice.py +++ b/core/google/cloud/streaming/stream_slice.py @@ -65,8 +65,8 @@ def read(self, size=None): slice indicates we should still be able to read more bytes, we raise :exc:`IncompleteRead`. - :type size: int or None - :param size: If provided, read no more than size bytes from the stream. + :type size: int + :param size: (Optional) If provided, read no more than size bytes from the stream. :rtype: bytes :returns: bytes read from this slice. diff --git a/core/google/cloud/streaming/transfer.py b/core/google/cloud/streaming/transfer.py index b24f41144d93..b17f63392815 100644 --- a/core/google/cloud/streaming/transfer.py +++ b/core/google/cloud/streaming/transfer.py @@ -280,8 +280,8 @@ def from_stream(cls, stream, auto_transfer=True, total_size=None, **kwds): :type stream: writable file-like object :param stream: the target file - :type total_size: int or None - :param total_size: total size of the file to be downloaded + :type total_size: int + :param total_size: (Optional) total size of the file to be downloaded :type auto_transfer: bool :param auto_transfer: should the transfer be started immediately @@ -457,8 +457,8 @@ def _compute_end_byte(self, start, end=None, use_chunks=True): :type start: int :param start: start byte of the range. - :type end: int or None - :param end: suggested last byte of the range. + :type end: int + :param end: (Optional) suggested last byte of the range. :type use_chunks: bool :param use_chunks: If False, ignore :attr:`chunksize`. @@ -493,8 +493,8 @@ def _get_chunk(self, start, end): :type start: int :param start: start byte of the range. - :type end: int or None - :param end: end byte of the range. + :type end: int + :param end: (Optional) end byte of the range. :rtype: :class:`google.cloud.streaming.http_wrapper.Response` :returns: response from the chunk request. @@ -555,8 +555,8 @@ def get_range(self, start, end=None, use_chunks=True): :type start: int :param start: Where to start fetching bytes. (See above.) - :type end: int or ``None`` - :param end: Where to stop fetching bytes. (See above.) + :type end: int + :param end: (Optional) Where to stop fetching bytes. (See above.) :type use_chunks: bool :param use_chunks: If False, ignore :attr:`chunksize` @@ -625,8 +625,8 @@ class Upload(_Transfer): :type mime_type: str: :param mime_type: MIME type of the upload. - :type total_size: int or None - :param total_size: Total upload size for the stream. + :type total_size: int + :param total_size: (Optional) Total upload size for the stream. :type http: :class:`httplib2.Http` (or workalike) :param http: Http instance used to perform requests. @@ -669,8 +669,8 @@ def from_file(cls, filename, mime_type=None, auto_transfer=True, **kwds): :type mime_type: str :param mime_type: MIMEtype of the file being uploaded - :type auto_transfer: bool or None - :param auto_transfer: should the transfer be started immediately + :type auto_transfer: bool + :param auto_transfer: (Optional) should the transfer be started immediately :type kwds: dict :param kwds: keyword arguments: passed @@ -700,11 +700,11 @@ def from_stream(cls, stream, mime_type, :type mime_type: str :param mime_type: MIMEtype of the file being uploaded - :type total_size: int or None - :param total_size: Size of the file being uploaded + :type total_size: int + :param total_size: (Optional) Size of the file being uploaded - :type auto_transfer: bool or None - :param auto_transfer: should the transfer be started immediately + :type auto_transfer: bool + :param auto_transfer: (Optional) should the transfer be started immediately :type kwds: dict :param kwds: keyword arguments: passed @@ -784,8 +784,8 @@ def total_size(self): def total_size(self, value): """Update total size of the stream to be uploaded. - :type value: int or None - :param value: the size + :type value: int + :param value: (Optional) the size """ self._ensure_uninitialized() self._total_size = value @@ -1048,8 +1048,8 @@ def _validate_chunksize(self, chunksize=None): Helper for :meth:`stream_file`. - :type chunksize: int or None - :param chunksize: the chunk size to be tested. + :type chunksize: int + :param chunksize: (Optional) the chunk size to be tested. :raises: :exc:`ValueError` if ``chunksize`` is not a multiple of the server-specified granulariy. diff --git a/datastore/google/cloud/datastore/connection.py b/datastore/google/cloud/datastore/connection.py index 5ee84eadf874..74070b142355 100644 --- a/datastore/google/cloud/datastore/connection.py +++ b/datastore/google/cloud/datastore/connection.py @@ -569,8 +569,8 @@ def commit(self, project, request, transaction_id): :type request: :class:`._generated.datastore_pb2.CommitRequest` :param request: The protobuf with the mutations being committed. - :type transaction_id: str or None - :param transaction_id: The transaction ID returned from + :type transaction_id: str + :param transaction_id: (Optional) The transaction ID returned from :meth:`begin_transaction`. Non-transactional batches must pass ``None``. diff --git a/datastore/google/cloud/datastore/key.py b/datastore/google/cloud/datastore/key.py index 38fe7a9d8128..d814553434ca 100644 --- a/datastore/google/cloud/datastore/key.py +++ b/datastore/google/cloud/datastore/key.py @@ -388,8 +388,8 @@ def _validate_project(project, parent): :type project: str :param project: A project. - :type parent: :class:`google.cloud.datastore.key.Key` or ``NoneType`` - :param parent: The parent of the key or ``None``. + :type parent: :class:`google.cloud.datastore.key.Key` + :param parent: (Optional) The parent of the key or ``None``. :rtype: str :returns: The ``project`` passed in, or implied from the environment. diff --git a/datastore/google/cloud/datastore/query.py b/datastore/google/cloud/datastore/query.py index ac69b4805844..4de07409f2f9 100644 --- a/datastore/google/cloud/datastore/query.py +++ b/datastore/google/cloud/datastore/query.py @@ -38,12 +38,12 @@ class Query(object): :param project: The project associated with the query. If not passed, uses the client's value. - :type namespace: str or None - :param namespace: The namespace to which to restrict results. If not + :type namespace: str + :param namespace: (Optional) The namespace to which to restrict results. If not passed, uses the client's value. - :type ancestor: :class:`google.cloud.datastore.key.Key` or None - :param ancestor: key of the ancestor to which this query's results are + :type ancestor: :class:`google.cloud.datastore.key.Key` + :param ancestor: (Optional) key of the ancestor to which this query's results are restricted. :type filters: sequence of (property_name, operator, value) tuples @@ -327,8 +327,8 @@ def fetch(self, limit=None, offset=0, start_cursor=None, end_cursor=None, >>> list(query.fetch(1)) [] - :type limit: int or None - :param limit: An optional limit passed through to the iterator. + :type limit: int + :param limit: (Optional) An optional limit passed through to the iterator. :type offset: int :param offset: An optional offset passed through to the iterator. diff --git a/dns/google/cloud/dns/changes.py b/dns/google/cloud/dns/changes.py index 98dd15eba963..85559b773229 100644 --- a/dns/google/cloud/dns/changes.py +++ b/dns/google/cloud/dns/changes.py @@ -169,8 +169,8 @@ def delete_record_set(self, record_set): def _require_client(self, client): """Check client or verify over-ride. - :type client: :class:`google.cloud.dns.client.Client` or ``NoneType`` - :param client: the client to use. If not passed, falls back to the + :type client: :class:`google.cloud.dns.client.Client` + :param client: (Optional) the client to use. If not passed, falls back to the ``client`` stored on the current zone. :rtype: :class:`google.cloud.dns.client.Client` @@ -207,8 +207,8 @@ def create(self, client=None): See: https://cloud.google.com/dns/api/v1/changes/create - :type client: :class:`google.cloud.dns.client.Client` or ``NoneType`` - :param client: the client to use. If not passed, falls back to the + :type client: :class:`google.cloud.dns.client.Client` + :param client: (Optional) the client to use. If not passed, falls back to the ``client`` stored on the current zone. """ if len(self.additions) == 0 and len(self.deletions) == 0: @@ -226,8 +226,8 @@ def exists(self, client=None): See https://cloud.google.com/dns/api/v1/changes/get - :type client: :class:`google.cloud.dns.client.Client` or ``NoneType`` - :param client: the client to use. If not passed, falls back to the + :type client: :class:`google.cloud.dns.client.Client` + :param client: (Optional) the client to use. If not passed, falls back to the ``client`` stored on the current zone. :rtype: bool @@ -248,8 +248,8 @@ def reload(self, client=None): See https://cloud.google.com/dns/api/v1/changes/get - :type client: :class:`google.cloud.dns.client.Client` or ``NoneType`` - :param client: the client to use. If not passed, falls back to the + :type client: :class:`google.cloud.dns.client.Client` + :param client: (Optional) the client to use. If not passed, falls back to the ``client`` stored on the current zone. """ client = self._require_client(client) diff --git a/dns/google/cloud/dns/client.py b/dns/google/cloud/dns/client.py index 2417bad76f16..19ec131db8ea 100644 --- a/dns/google/cloud/dns/client.py +++ b/dns/google/cloud/dns/client.py @@ -91,12 +91,12 @@ def zone(self, name, dns_name=None, description=None): :type name: str :param name: Name of the zone. - :type dns_name: str or :class:`NoneType` - :param dns_name: DNS name of the zone. If not passed, then calls + :type dns_name: str + :param dns_name: (Optional) DNS name of the zone. If not passed, then calls to :meth:`zone.create` will fail. - :type description: str or :class:`NoneType` - :param description: the description for the zone. If not passed, + :type description: str + :param description: (Optional) the description for the zone. If not passed, defaults to the value of 'dns_name'. :rtype: :class:`google.cloud.dns.zone.ManagedZone` diff --git a/dns/google/cloud/dns/zone.py b/dns/google/cloud/dns/zone.py index 10d656a9b74a..3607238f27c6 100644 --- a/dns/google/cloud/dns/zone.py +++ b/dns/google/cloud/dns/zone.py @@ -32,16 +32,16 @@ class ManagedZone(object): :type name: str :param name: the name of the zone - :type dns_name: str or :class:`NoneType` - :param dns_name: the DNS name of the zone. If not passed, then calls + :type dns_name: str + :param dns_name: (Optional) the DNS name of the zone. If not passed, then calls to :meth:`create` will fail. :type client: :class:`google.cloud.dns.client.Client` :param client: A client which holds credentials and project configuration for the zone (which requires a project). - :type description: str or :class:`NoneType` - :param description: the description for the zone. If not passed, defaults + :type description: str + :param description: (Optional) the description for the zone. If not passed, defaults to the value of 'dns_name'. """ @@ -135,8 +135,8 @@ def description(self): def description(self, value): """Update description of the zone. - :type value: str, or ``NoneType`` - :param value: new description + :type value: str + :param value: (Optional) new description :raises: ValueError for invalid value types. """ @@ -162,8 +162,8 @@ def name_server_set(self): def name_server_set(self, value): """Update named set of DNS name servers. - :type value: str, or ``NoneType`` - :param value: new title + :type value: str + :param value: (Optional) new title :raises: ValueError for invalid value types. """ @@ -202,8 +202,8 @@ def changes(self): def _require_client(self, client): """Check client or verify over-ride. - :type client: :class:`google.cloud.dns.client.Client` or ``NoneType`` - :param client: the client to use. If not passed, falls back to the + :type client: :class:`google.cloud.dns.client.Client` + :param client: (Optional) the client to use. If not passed, falls back to the ``client`` stored on the current zone. :rtype: :class:`google.cloud.dns.client.Client` @@ -250,8 +250,8 @@ def create(self, client=None): See: https://cloud.google.com/dns/api/v1/managedZones/create - :type client: :class:`google.cloud.dns.client.Client` or ``NoneType`` - :param client: the client to use. If not passed, falls back to the + :type client: :class:`google.cloud.dns.client.Client` + :param client: (Optional) the client to use. If not passed, falls back to the ``client`` stored on the current zone. """ client = self._require_client(client) @@ -266,8 +266,8 @@ def exists(self, client=None): See https://cloud.google.com/dns/api/v1/managedZones/get - :type client: :class:`google.cloud.dns.client.Client` or ``NoneType`` - :param client: the client to use. If not passed, falls back to the + :type client: :class:`google.cloud.dns.client.Client` + :param client: (Optional) the client to use. If not passed, falls back to the ``client`` stored on the current zone. :rtype: bool @@ -289,8 +289,8 @@ def reload(self, client=None): See https://cloud.google.com/dns/api/v1/managedZones/get - :type client: :class:`google.cloud.dns.client.Client` or ``NoneType`` - :param client: the client to use. If not passed, falls back to the + :type client: :class:`google.cloud.dns.client.Client` + :param client: (Optional) the client to use. If not passed, falls back to the ``client`` stored on the current zone. """ client = self._require_client(client) @@ -305,8 +305,8 @@ def delete(self, client=None): See: https://cloud.google.com/dns/api/v1/managedZones/delete - :type client: :class:`google.cloud.dns.client.Client` or ``NoneType`` - :param client: the client to use. If not passed, falls back to the + :type client: :class:`google.cloud.dns.client.Client` + :param client: (Optional) the client to use. If not passed, falls back to the ``client`` stored on the current zone. """ client = self._require_client(client) @@ -328,8 +328,8 @@ def list_resource_record_sets(self, max_results=None, page_token=None, not passed, the API will return the first page of zones. - :type client: :class:`google.cloud.dns.client.Client` or ``NoneType`` - :param client: the client to use. If not passed, falls back to the + :type client: :class:`google.cloud.dns.client.Client` + :param client: (Optional) the client to use. If not passed, falls back to the ``client`` stored on the current zone. :rtype: :class:`~google.cloud.iterator.Iterator` @@ -361,8 +361,8 @@ def list_changes(self, max_results=None, page_token=None, client=None): not passed, the API will return the first page of zones. - :type client: :class:`google.cloud.dns.client.Client` or ``NoneType`` - :param client: the client to use. If not passed, falls back to the + :type client: :class:`google.cloud.dns.client.Client` + :param client: (Optional) the client to use. If not passed, falls back to the ``client`` stored on the current zone. :rtype: :class:`~google.cloud.iterator.Iterator` diff --git a/logging/google/cloud/logging/client.py b/logging/google/cloud/logging/client.py index ab02c90f464e..482cf2576eae 100644 --- a/logging/google/cloud/logging/client.py +++ b/logging/google/cloud/logging/client.py @@ -139,8 +139,8 @@ def _entry_from_resource(self, resource, loggers): :type resource: dict :param resource: one entry resource from API response - :type loggers: dict or None - :param loggers: A mapping of logger fullnames -> loggers. If not + :type loggers: dict + :param loggers: (Optional) A mapping of logger fullnames -> loggers. If not passed, the entry will have a newly-created logger. :rtype: One of: diff --git a/logging/google/cloud/logging/entries.py b/logging/google/cloud/logging/entries.py index bbedfa113006..b4cd6e714001 100644 --- a/logging/google/cloud/logging/entries.py +++ b/logging/google/cloud/logging/entries.py @@ -56,19 +56,19 @@ class _BaseEntry(object): :type logger: :class:`google.cloud.logging.logger.Logger` :param logger: the logger used to write the entry. - :type insert_id: text, or :class:`NoneType` + :type insert_id: text :param insert_id: (optional) the ID used to identify an entry uniquely. - :type timestamp: :class:`datetime.datetime`, or :class:`NoneType` + :type timestamp: :class:`datetime.datetime` :param timestamp: (optional) timestamp for the entry - :type labels: dict or :class:`NoneType` + :type labels: dict :param labels: (optional) mapping of labels for the entry - :type severity: str or :class:`NoneType` + :type severity: str :param severity: (optional) severity of event being logged. - :type http_request: dict or :class:`NoneType` + :type http_request: dict :param http_request: (optional) info about HTTP request associated with the entry """ @@ -94,8 +94,8 @@ def from_api_repr(cls, resource, client, loggers=None): :param client: Client which holds credentials and project configuration. - :type loggers: dict or None - :param loggers: A mapping of logger fullnames -> loggers. If not + :type loggers: dict + :param loggers: (Optional) A mapping of logger fullnames -> loggers. If not passed, the entry will have a newly-created logger. :rtype: :class:`google.cloud.logging.entries.TextEntry` diff --git a/logging/google/cloud/logging/logger.py b/logging/google/cloud/logging/logger.py index 38cc5110e271..d078dda29726 100644 --- a/logging/google/cloud/logging/logger.py +++ b/logging/google/cloud/logging/logger.py @@ -32,7 +32,7 @@ class Logger(object): :param client: A client which holds credentials and project configuration for the logger (which requires a project). - :type labels: dict or :class:`NoneType` + :type labels: dict :param labels: (optional) mapping of default labels for entries written via this logger. """ @@ -99,25 +99,25 @@ def _make_entry_resource(self, text=None, info=None, message=None, Only one of ``text``, ``info``, or ``message`` should be passed. - :type text: str or :class:`NoneType` - :param text: text payload + :type text: str + :param text: (Optional) text payload - :type info: dict or :class:`NoneType` - :param info: struct payload + :type info: dict + :param info: (Optional) struct payload :type message: Protobuf message or :class:`NoneType` :param message: protobuf payload - :type labels: dict or :class:`NoneType` - :param labels: labels passed in to calling method. + :type labels: dict + :param labels: (Optional) labels passed in to calling method. - :type insert_id: str or :class:`NoneType` + :type insert_id: str :param insert_id: (optional) unique ID for log entry. - :type severity: str or :class:`NoneType` + :type severity: str :param severity: (optional) severity of event being logged. - :type http_request: dict or :class:`NoneType` + :type http_request: dict :param http_request: (optional) info about HTTP request associated with the entry @@ -172,16 +172,16 @@ def log_text(self, text, client=None, labels=None, insert_id=None, :param client: the client to use. If not passed, falls back to the ``client`` stored on the current logger. - :type labels: dict or :class:`NoneType` + :type labels: dict :param labels: (optional) mapping of labels for the entry. - :type insert_id: str or :class:`NoneType` + :type insert_id: str :param insert_id: (optional) unique ID for log entry. - :type severity: str or :class:`NoneType` + :type severity: str :param severity: (optional) severity of event being logged. - :type http_request: dict or :class:`NoneType` + :type http_request: dict :param http_request: (optional) info about HTTP request associated with the entry """ @@ -206,16 +206,16 @@ def log_struct(self, info, client=None, labels=None, insert_id=None, :param client: the client to use. If not passed, falls back to the ``client`` stored on the current logger. - :type labels: dict or :class:`NoneType` + :type labels: dict :param labels: (optional) mapping of labels for the entry. - :type insert_id: str or :class:`NoneType` + :type insert_id: str :param insert_id: (optional) unique ID for log entry. - :type severity: str or :class:`NoneType` + :type severity: str :param severity: (optional) severity of event being logged. - :type http_request: dict or :class:`NoneType` + :type http_request: dict :param http_request: (optional) info about HTTP request associated with the entry. """ @@ -240,16 +240,16 @@ def log_proto(self, message, client=None, labels=None, insert_id=None, :param client: the client to use. If not passed, falls back to the ``client`` stored on the current logger. - :type labels: dict or :class:`NoneType` + :type labels: dict :param labels: (optional) mapping of labels for the entry. - :type insert_id: str or :class:`NoneType` + :type insert_id: str :param insert_id: (optional) unique ID for log entry. - :type severity: str or :class:`NoneType` + :type severity: str :param severity: (optional) severity of event being logged. - :type http_request: dict or :class:`NoneType` + :type http_request: dict :param http_request: (optional) info about HTTP request associated with the entry. """ @@ -347,16 +347,16 @@ def log_text(self, text, labels=None, insert_id=None, severity=None, :type text: str :param text: the text entry - :type labels: dict or :class:`NoneType` + :type labels: dict :param labels: (optional) mapping of labels for the entry. - :type insert_id: str or :class:`NoneType` + :type insert_id: str :param insert_id: (optional) unique ID for log entry. - :type severity: str or :class:`NoneType` + :type severity: str :param severity: (optional) severity of event being logged. - :type http_request: dict or :class:`NoneType` + :type http_request: dict :param http_request: (optional) info about HTTP request associated with the entry. """ @@ -370,16 +370,16 @@ def log_struct(self, info, labels=None, insert_id=None, severity=None, :type info: dict :param info: the struct entry - :type labels: dict or :class:`NoneType` + :type labels: dict :param labels: (optional) mapping of labels for the entry. - :type insert_id: str or :class:`NoneType` + :type insert_id: str :param insert_id: (optional) unique ID for log entry. - :type severity: str or :class:`NoneType` + :type severity: str :param severity: (optional) severity of event being logged. - :type http_request: dict or :class:`NoneType` + :type http_request: dict :param http_request: (optional) info about HTTP request associated with the entry. """ @@ -393,16 +393,16 @@ def log_proto(self, message, labels=None, insert_id=None, severity=None, :type message: protobuf message :param message: the protobuf entry - :type labels: dict or :class:`NoneType` + :type labels: dict :param labels: (optional) mapping of labels for the entry. - :type insert_id: str or :class:`NoneType` + :type insert_id: str :param insert_id: (optional) unique ID for log entry. - :type severity: str or :class:`NoneType` + :type severity: str :param severity: (optional) severity of event being logged. - :type http_request: dict or :class:`NoneType` + :type http_request: dict :param http_request: (optional) info about HTTP request associated with the entry. """ diff --git a/monitoring/google/cloud/monitoring/_dataframe.py b/monitoring/google/cloud/monitoring/_dataframe.py index 5c0d89bb6ddb..606de38039e9 100644 --- a/monitoring/google/cloud/monitoring/_dataframe.py +++ b/monitoring/google/cloud/monitoring/_dataframe.py @@ -34,9 +34,9 @@ def _build_dataframe(time_series_iterable, :param time_series_iterable: An iterable (e.g., a query object) yielding time series. - :type label: str or None + :type label: str :param label: - The label name to use for the dataframe header. This can be the name + (Optional) The label name to use for the dataframe header. This can be the name of a resource label or metric label (e.g., ``"instance_name"``), or the string ``"resource_type"``. diff --git a/monitoring/google/cloud/monitoring/client.py b/monitoring/google/cloud/monitoring/client.py index 7bc3c31bf7d6..a6958b09a075 100644 --- a/monitoring/google/cloud/monitoring/client.py +++ b/monitoring/google/cloud/monitoring/client.py @@ -88,8 +88,8 @@ def query(self, demonstration purposes and is subject to change. See the `supported metrics`_. - :type end_time: :class:`datetime.datetime` or None - :param end_time: The end time (inclusive) of the time interval + :type end_time: :class:`datetime.datetime` + :param end_time: (Optional) The end time (inclusive) of the time interval for which results should be returned, as a datetime object. The default is the start of the current minute. @@ -362,13 +362,13 @@ def list_metric_descriptors(self, filter_string=None, type_prefix=None): ... type_prefix='custom.'): ... print(descriptor.type) - :type filter_string: str or None + :type filter_string: str :param filter_string: - An optional filter expression describing the metric descriptors + (Optional) An optional filter expression describing the metric descriptors to be returned. See the `filter documentation`_. - :type type_prefix: str or None - :param type_prefix: An optional prefix constraining the selected + :type type_prefix: str + :param type_prefix: (Optional) An optional prefix constraining the selected metric types. This adds ``metric.type = starts_with("")`` to the filter. @@ -408,9 +408,9 @@ def list_resource_descriptors(self, filter_string=None): >>> for descriptor in client.list_resource_descriptors(): ... print(descriptor.type) - :type filter_string: str or None + :type filter_string: str :param filter_string: - An optional filter expression describing the resource descriptors + (Optional) An optional filter expression describing the resource descriptors to be returned. See the `filter documentation`_. :rtype: list of @@ -430,21 +430,21 @@ def group(self, group_id=None, display_name=None, parent_id=None, This will not make an HTTP request; it simply instantiates a group object owned by this client. - :type group_id: str or None - :param group_id: The ID of the group. + :type group_id: str + :param group_id: (Optional) The ID of the group. - :type display_name: str or None + :type display_name: str :param display_name: - A user-assigned name for this group, used only for display + (Optional) A user-assigned name for this group, used only for display purposes. - :type parent_id: str or None + :type parent_id: str :param parent_id: - The ID of the group's parent, if it has one. + (Optional) The ID of the group's parent, if it has one. - :type filter_string: str or None + :type filter_string: str :param filter_string: - The filter string used to determine which monitored resources + (Optional) The filter string used to determine which monitored resources belong to this group. :type is_cluster: bool diff --git a/monitoring/google/cloud/monitoring/group.py b/monitoring/google/cloud/monitoring/group.py index 7779585301fa..1fb7bf044b92 100644 --- a/monitoring/google/cloud/monitoring/group.py +++ b/monitoring/google/cloud/monitoring/group.py @@ -41,8 +41,8 @@ def _group_id_from_name(path, project=None): :type path: str :param path: URI path for a group API request. - :type project: str or None - :param project: The project associated with the request. It is + :type project: str + :param project: (Optional) The project associated with the request. It is included for validation purposes. :rtype: str @@ -76,20 +76,20 @@ class Group(object): :type client: :class:`google.cloud.monitoring.client.Client` :param client: A client for operating on the metric descriptor. - :type group_id: str or None - :param group_id: The ID of the group. + :type group_id: str + :param group_id: (Optional) The ID of the group. - :type display_name: str or None + :type display_name: str :param display_name: - A user-assigned name for this group, used only for display purposes. + (Optional) A user-assigned name for this group, used only for display purposes. - :type parent_id: str or None + :type parent_id: str :param parent_id: - The ID of the group's parent, if it has one. + (Optional) The ID of the group's parent, if it has one. - :type filter_string: str or None + :type filter_string: str :param filter_string: - The filter string used to determine which monitored resources belong to + (Optional) The filter string used to determine which monitored resources belong to this group. :type is_cluster: bool @@ -296,21 +296,21 @@ def list_members(self, filter_string=None, end_time=None, start_time=None): ... print(member) - :type filter_string: str or None + :type filter_string: str :param filter_string: - An optional list filter describing the members to be returned. The + (Optional) An optional list filter describing the members to be returned. The filter may reference the type, labels, and metadata of monitored resources that comprise the group. See the `filter documentation`_. - :type end_time: :class:`datetime.datetime` or None + :type end_time: :class:`datetime.datetime` :param end_time: - The end time (inclusive) of the time interval for which results + (Optional) The end time (inclusive) of the time interval for which results should be returned, as a datetime object. If ``start_time`` is specified, then this must also be specified. - :type start_time: :class:`datetime.datetime` or None + :type start_time: :class:`datetime.datetime` :param start_time: - The start time (exclusive) of the time interval for which results + (Optional) The start time (exclusive) of the time interval for which results should be returned, as a datetime object. :rtype: list of :class:`~google.cloud.monitoring.resource.Resource` @@ -386,19 +386,19 @@ def _list(cls, client, children_of_group=None, ancestors_of_group=None, :type client: :class:`google.cloud.monitoring.client.Client` :param client: The client to use. - :type children_of_group: str or None + :type children_of_group: str :param children_of_group: - Returns groups whose parent_name field contains the group name. If + (Optional) Returns groups whose parent_name field contains the group name. If no groups have this parent, the results are empty. - :type ancestors_of_group: str or None + :type ancestors_of_group: str :param ancestors_of_group: - Returns groups that are ancestors of the specified group. If the + (Optional) Returns groups that are ancestors of the specified group. If the specified group has no immediate parent, the results are empty. - :type descendants_of_group: str or None + :type descendants_of_group: str :param descendants_of_group: - Returns the descendants of the specified group. This is a superset + (Optional) Returns the descendants of the specified group. This is a superset of the results returned by the children_of_group filter, and includes children-of-children, and so forth. diff --git a/monitoring/google/cloud/monitoring/metric.py b/monitoring/google/cloud/monitoring/metric.py index f2cb5c7522d0..81cd1bb591d7 100644 --- a/monitoring/google/cloud/monitoring/metric.py +++ b/monitoring/google/cloud/monitoring/metric.py @@ -102,9 +102,9 @@ class MetricDescriptor(object): :type display_name: str :param display_name: An optional concise name for the metric. - :type name: str or None + :type name: str :param name: - The "resource name" of the metric descriptor. For example: + (Optional) The "resource name" of the metric descriptor. For example: ``"projects//metricDescriptors/"``. As retrieved from the service, this will always be specified. You can and should omit it when constructing an instance for @@ -198,13 +198,13 @@ def _list(cls, client, filter_string=None, type_prefix=None): :type client: :class:`google.cloud.monitoring.client.Client` :param client: The client to use. - :type filter_string: str or None + :type filter_string: str :param filter_string: - An optional filter expression describing the metric descriptors + (Optional) An optional filter expression describing the metric descriptors to be returned. See the `filter documentation`_. - :type type_prefix: str or None - :param type_prefix: An optional prefix constraining the selected + :type type_prefix: str + :param type_prefix: (Optional) An optional prefix constraining the selected metric types. This adds ``metric.type = starts_with("")`` to the filter. diff --git a/monitoring/google/cloud/monitoring/query.py b/monitoring/google/cloud/monitoring/query.py index bac9d92d9e34..3513bf09ea01 100644 --- a/monitoring/google/cloud/monitoring/query.py +++ b/monitoring/google/cloud/monitoring/query.py @@ -86,8 +86,8 @@ class Query(object): demonstration purposes and is subject to change. See the `supported metrics`_. - :type end_time: :class:`datetime.datetime` or None - :param end_time: The end time (inclusive) of the time interval + :type end_time: :class:`datetime.datetime` + :param end_time: (Optional) The end time (inclusive) of the time interval for which results should be returned, as a datetime object. The default is the start of the current minute. @@ -179,8 +179,8 @@ def select_interval(self, end_time, start_time=None): :param end_time: The end time (inclusive) of the time interval for which results should be returned, as a datetime object. - :type start_time: :class:`datetime.datetime` or None - :param start_time: The start time (exclusive) of the time interval + :type start_time: :class:`datetime.datetime` + :param start_time: (Optional) The start time (exclusive) of the time interval for which results should be returned, as a datetime object. If not specified, the interval is a point in time. @@ -446,9 +446,9 @@ def iter(self, headers_only=False, page_size=None): :param headers_only: Whether to omit the point data from the time series objects. - :type page_size: int or None + :type page_size: int :param page_size: - An optional positive number specifying the maximum number of + (Optional) An optional positive number specifying the maximum number of points to return per page. This can be used to control how far the iterator reads ahead. @@ -510,11 +510,11 @@ def _build_query_params(self, headers_only=False, Whether to omit the point data from the :class:`~google.cloud.monitoring.timeseries.TimeSeries` objects. - :type page_size: int or None - :param page_size: A limit on the number of points to return per page. + :type page_size: int + :param page_size: (Optional) A limit on the number of points to return per page. - :type page_token: str or None - :param page_token: A token to continue the retrieval. + :type page_token: str + :param page_token: (Optional) A token to continue the retrieval. """ yield 'filter', self.filter @@ -575,8 +575,8 @@ def as_dataframe(self, label=None, labels=None): dataframe = query.as_dataframe( labels=['resource_type', 'instance_id']) - :type label: str or None - :param label: The label name to use for the dataframe header. + :type label: str + :param label: (Optional) The label name to use for the dataframe header. This can be the name of a resource label or metric label (e.g., ``"instance_name"``), or the string ``"resource_type"``. diff --git a/monitoring/google/cloud/monitoring/resource.py b/monitoring/google/cloud/monitoring/resource.py index e951006c1cf5..4156d0f30754 100644 --- a/monitoring/google/cloud/monitoring/resource.py +++ b/monitoring/google/cloud/monitoring/resource.py @@ -88,9 +88,9 @@ def _list(cls, client, filter_string=None): :type client: :class:`google.cloud.monitoring.client.Client` :param client: The client to use. - :type filter_string: str or None + :type filter_string: str :param filter_string: - An optional filter expression describing the resource descriptors + (Optional) An optional filter expression describing the resource descriptors to be returned. See the `filter documentation`_. :rtype: list of :class:`ResourceDescriptor` diff --git a/monitoring/google/cloud/monitoring/timeseries.py b/monitoring/google/cloud/monitoring/timeseries.py index b46e5d830265..de67068ab097 100644 --- a/monitoring/google/cloud/monitoring/timeseries.py +++ b/monitoring/google/cloud/monitoring/timeseries.py @@ -179,8 +179,8 @@ class Point(collections.namedtuple('Point', 'end_time start_time value')): :type end_time: str :param end_time: The end time in RFC3339 UTC "Zulu" format. - :type start_time: str or None - :param start_time: An optional start time in RFC3339 UTC "Zulu" format. + :type start_time: str + :param start_time: (Optional) An optional start time in RFC3339 UTC "Zulu" format. :type value: object :param value: The metric value. This can be a scalar or a distribution. diff --git a/pubsub/google/cloud/pubsub/_gax.py b/pubsub/google/cloud/pubsub/_gax.py index d346cf526c63..da4ae25625c5 100644 --- a/pubsub/google/cloud/pubsub/_gax.py +++ b/pubsub/google/cloud/pubsub/_gax.py @@ -269,12 +269,12 @@ def subscription_create(self, subscription_path, topic_path, subscribed, in format ``projects//topics/``. - :type ack_deadline: int, or ``NoneType`` - :param ack_deadline: the deadline (in seconds) by which messages pulled + :type ack_deadline: int + :param ack_deadline: (Optional) the deadline (in seconds) by which messages pulled from the back-end must be acknowledged. - :type push_endpoint: str, or ``NoneType`` - :param push_endpoint: URL to which messages will be pushed by the + :type push_endpoint: str + :param push_endpoint: (Optional) URL to which messages will be pushed by the back-end. If not set, the application must pull messages. @@ -351,8 +351,8 @@ def subscription_modify_push_config(self, subscription_path, the fully-qualified path of the new subscription, in format ``projects//subscriptions/``. - :type push_endpoint: str, or ``NoneType`` - :param push_endpoint: URL to which messages will be pushed by the + :type push_endpoint: str + :param push_endpoint: (Optional) URL to which messages will be pushed by the back-end. If not set, the application must pull messages. """ diff --git a/pubsub/google/cloud/pubsub/connection.py b/pubsub/google/cloud/pubsub/connection.py index e854495b3682..1cabb127bc37 100644 --- a/pubsub/google/cloud/pubsub/connection.py +++ b/pubsub/google/cloud/pubsub/connection.py @@ -309,12 +309,12 @@ def subscription_create(self, subscription_path, topic_path, subscribed, in format ``projects//topics/``. - :type ack_deadline: int, or ``NoneType`` - :param ack_deadline: the deadline (in seconds) by which messages pulled + :type ack_deadline: int + :param ack_deadline: (Optional) the deadline (in seconds) by which messages pulled from the back-end must be acknowledged. - :type push_endpoint: str, or ``NoneType`` - :param push_endpoint: URL to which messages will be pushed by the + :type push_endpoint: str + :param push_endpoint: (Optional) URL to which messages will be pushed by the back-end. If not set, the application must pull messages. @@ -378,8 +378,8 @@ def subscription_modify_push_config(self, subscription_path, the fully-qualified path of the new subscription, in format ``projects//subscriptions/``. - :type push_endpoint: str, or ``NoneType`` - :param push_endpoint: URL to which messages will be pushed by the + :type push_endpoint: str + :param push_endpoint: (Optional) URL to which messages will be pushed by the back-end. If not set, the application must pull messages. """ diff --git a/pubsub/google/cloud/pubsub/message.py b/pubsub/google/cloud/pubsub/message.py index 8fd65b48785a..035693e82b9c 100644 --- a/pubsub/google/cloud/pubsub/message.py +++ b/pubsub/google/cloud/pubsub/message.py @@ -32,8 +32,8 @@ class Message(object): :type message_id: str :param message_id: An ID assigned to the message by the API. - :type attributes: dict or None - :param attributes: Extra metadata associated by the publisher with the + :type attributes: dict + :param attributes: (Optional) Extra metadata associated by the publisher with the message. """ _service_timestamp = None @@ -80,8 +80,8 @@ def service_timestamp(self): def from_api_repr(cls, api_repr): """Factory: construct message from API representation. - :type api_repr: dict or None - :param api_repr: The API representation of the message + :type api_repr: dict + :param api_repr: (Optional) The API representation of the message :rtype: :class:`Message` :returns: The message created from the response. diff --git a/pubsub/google/cloud/pubsub/subscription.py b/pubsub/google/cloud/pubsub/subscription.py index 79d9400bdc86..bf6882eab3cf 100644 --- a/pubsub/google/cloud/pubsub/subscription.py +++ b/pubsub/google/cloud/pubsub/subscription.py @@ -29,8 +29,8 @@ class Subscription(object): :type name: str :param name: the name of the subscription. - :type topic: :class:`google.cloud.pubsub.topic.Topic` or ``NoneType`` - :param topic: the topic to which the subscription belongs; if ``None``, + :type topic: :class:`google.cloud.pubsub.topic.Topic` + :param topic: (Optional) the topic to which the subscription belongs; if ``None``, the subscription's topic has been deleted. :type ack_deadline: int @@ -81,8 +81,8 @@ def from_api_repr(cls, resource, client, topics=None): :param client: Client which holds credentials and project configuration for a topic. - :type topics: dict or None - :param topics: A mapping of topic names -> topics. If not passed, + :type topics: dict + :param topics: (Optional) A mapping of topic names -> topics. If not passed, the subscription will have a newly-created topic. :rtype: :class:`google.cloud.pubsub.subscription.Subscription` diff --git a/scripts/run_pylint.py b/scripts/run_pylint.py index c18204c50e3c..9b4c77883a57 100644 --- a/scripts/run_pylint.py +++ b/scripts/run_pylint.py @@ -147,7 +147,7 @@ def get_python_files(all_files=None): NOTE: This requires ``git`` to be installed and requires that this is run within the ``git`` repository. - :type all_files: list or ``NoneType`` + :type all_files: list :param all_files: Optional list of files to be linted. :rtype: tuple diff --git a/storage/google/cloud/storage/acl.py b/storage/google/cloud/storage/acl.py index ce11dd859863..a1e5152fbe5c 100644 --- a/storage/google/cloud/storage/acl.py +++ b/storage/google/cloud/storage/acl.py @@ -419,8 +419,8 @@ def _save(self, acl, predefined, client): :param acl: The ACL object to save. If left blank, this will save current entries. - :type predefined: str or None - :param predefined: An identifier for a predefined ACL. Must be one + :type predefined: str + :param predefined: (Optional) An identifier for a predefined ACL. Must be one of the keys in :attr:`PREDEFINED_JSON_ACLS` If passed, `acl` must be None. diff --git a/storage/google/cloud/storage/batch.py b/storage/google/cloud/storage/batch.py index 7c52ce1a6cf3..a9443a8057ce 100644 --- a/storage/google/cloud/storage/batch.py +++ b/storage/google/cloud/storage/batch.py @@ -44,8 +44,8 @@ class MIMEApplicationHTTP(MIMEApplication): :type headers: dict :param headers: HTTP headers - :type body: str or None - :param body: HTTP payload + :type body: str + :param body: (Optional) HTTP payload """ def __init__(self, method, uri, headers, body): @@ -154,8 +154,8 @@ def _do_request(self, method, url, headers, data, target_object): :type data: str :param data: The data to send as the body of the request. - :type target_object: object or :class:`NoneType` - :param target_object: This allows us to enable custom behavior in our + :type target_object: object + :param target_object: (Optional) This allows us to enable custom behavior in our batch connection. Here we defer an HTTP request and complete initialization of the object at a later time. diff --git a/storage/google/cloud/storage/blob.py b/storage/google/cloud/storage/blob.py index 145b5417c98f..16da5782fef5 100644 --- a/storage/google/cloud/storage/blob.py +++ b/storage/google/cloud/storage/blob.py @@ -94,8 +94,8 @@ def chunk_size(self): def chunk_size(self, value): """Set the blob's default chunk size. - :type value: int or ``NoneType`` - :param value: The current blob's chunk size, if it is set. + :type value: int + :param value: (Optional) The current blob's chunk size, if it is set. :raises: :class:`ValueError` if ``value`` is not ``None`` and is not a multiple of 256 KB. @@ -450,7 +450,7 @@ def upload_from_file(self, file_obj, rewind=False, size=None, :func:`os.fstat`. (If the file handle is not from the filesystem this won't be possible.) - :type content_type: str or ``NoneType`` + :type content_type: str :param content_type: Optional type of content being uploaded. :type num_retries: int @@ -567,7 +567,7 @@ def upload_from_filename(self, filename, content_type=None, client=None): :type filename: str :param filename: The path to the file. - :type content_type: str or ``NoneType`` + :type content_type: str :param content_type: Optional type of content being uploaded. :type client: :class:`~google.cloud.storage.client.Client` or @@ -861,8 +861,8 @@ def metadata(self, value): See: https://cloud.google.com/storage/docs/json_api/v1/objects - :type value: dict or ``NoneType`` - :param value: The blob metadata to set. + :type value: dict + :param value: (Optional) The blob metadata to set. """ self._patch_property('metadata', value) diff --git a/storage/google/cloud/storage/client.py b/storage/google/cloud/storage/client.py index f764e98ab8e9..34f5336a97b7 100644 --- a/storage/google/cloud/storage/client.py +++ b/storage/google/cloud/storage/client.py @@ -227,24 +227,24 @@ def list_buckets(self, max_results=None, page_token=None, prefix=None, This implements "storage.buckets.list". - :type max_results: int or ``NoneType`` + :type max_results: int :param max_results: Optional. Maximum number of buckets to return. - :type page_token: str or ``NoneType`` + :type page_token: str :param page_token: Optional. Opaque marker for the next "page" of buckets. If not passed, will return the first page of buckets. - :type prefix: str or ``NoneType`` + :type prefix: str :param prefix: Optional. Filter results to buckets whose names begin with this prefix. - :type projection: str or ``NoneType`` - :param projection: If used, must be 'full' or 'noAcl'. Defaults to + :type projection: str + :param projection: (Optional) If used, must be 'full' or 'noAcl'. Defaults to 'noAcl'. Specifies the set of properties to return. - :type fields: str or ``NoneType`` - :param fields: Selector specifying which fields to include in a + :type fields: str + :param fields: (Optional) Selector specifying which fields to include in a partial response. Must be a list of fields. For example to get a partial response with just the next page token and the language of each bucket returned: