Skip to content

Commit

Permalink
Remove None from param types and add (Optional).
Browse files Browse the repository at this point in the history
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:
googleapis#2580 (review)
  • Loading branch information
tswast committed Oct 21, 2016
1 parent bf0c541 commit ec781b6
Show file tree
Hide file tree
Showing 34 changed files with 275 additions and 274 deletions.
16 changes: 8 additions & 8 deletions bigquery/google/cloud/bigquery/dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
"""
Expand All @@ -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.
"""
Expand All @@ -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.
"""
Expand All @@ -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.
"""
Expand Down
16 changes: 8 additions & 8 deletions bigquery/google/cloud/bigquery/query.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
63 changes: 32 additions & 31 deletions bigquery/google/cloud/bigquery/table.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
"""
Expand All @@ -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")
Expand All @@ -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.
"""
Expand All @@ -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.
"""
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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``
Expand Down Expand Up @@ -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
``<name> + <template_suffix>`` 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 ``<name> + <template_suffix>`` 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``
Expand Down
8 changes: 4 additions & 4 deletions core/google/cloud/_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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.
Expand Down
12 changes: 6 additions & 6 deletions core/google/cloud/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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.
Expand Down
4 changes: 2 additions & 2 deletions core/google/cloud/streaming/buffered_stream.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
8 changes: 4 additions & 4 deletions core/google/cloud/streaming/http_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions core/google/cloud/streaming/stream_slice.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
40 changes: 20 additions & 20 deletions core/google/cloud/streaming/transfer.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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`.
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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`
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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.
Expand Down
Loading

0 comments on commit ec781b6

Please sign in to comment.