Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove None & NoneType from parameter types in docstrings. #2584

Merged
merged 3 commits into from
Oct 21, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
19 changes: 10 additions & 9 deletions bigquery/google/cloud/bigquery/query.py
Original file line number Diff line number Diff line change
Expand Up @@ -345,18 +345,19 @@ 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
complete
: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
``NoneType``
Expand Down
64 changes: 33 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,18 @@ 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) a descriptive name for this table.

:type description: str or ``NoneType``
:param description: point in time at which the table expires.
:type description: str
:param description: (Optional) a description of this table.

:type location: str or ``NoneType``
:param location: point in time at which the table expires.
:type location: str
:param location:
(Optional) the geographic location where the table resides.

: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 +655,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 +716,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
27 changes: 14 additions & 13 deletions core/google/cloud/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,11 +214,11 @@ 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.
This can allow custom behavior, for example, to
defer an HTTP request and complete initialization
of the object at a later time.
: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.

:rtype: tuple of ``response`` (a dictionary of sorts)
and ``content`` (a string).
Expand Down Expand Up @@ -261,9 +261,10 @@ 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
by a superclass.
: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)
and ``content`` (a string).
Expand Down Expand Up @@ -323,11 +324,11 @@ 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
callers. This can allow custom behavior, for
example, to defer an HTTP request and complete
initialization of the object at a later time.
: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.

:raises: Exception if the response code is not 200 OK.
:rtype: dict or str
Expand Down
6 changes: 4 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,10 @@ 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
9 changes: 5 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,9 @@ 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 +116,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
6 changes: 4 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,10 @@ 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
Loading