Skip to content

Commit e31e05a

Browse files
authored
Merge pull request googleapis#2584 from tswast/nonetype-to-optional
Remove None & NoneType from parameter types in docstrings.
2 parents a98f673 + 054dfb3 commit e31e05a

File tree

34 files changed

+407
-362
lines changed

34 files changed

+407
-362
lines changed

bigquery/google/cloud/bigquery/dataset.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -216,8 +216,8 @@ def default_table_expiration_ms(self):
216216
def default_table_expiration_ms(self, value):
217217
"""Update default expiration time for tables in the dataset.
218218
219-
:type value: int, or ``NoneType``
220-
:param value: new default time, in milliseconds
219+
:type value: int
220+
:param value: (Optional) new default time, in milliseconds
221221
222222
:raises: ValueError for invalid value types.
223223
"""
@@ -238,8 +238,8 @@ def description(self):
238238
def description(self, value):
239239
"""Update description of the dataset.
240240
241-
:type value: str, or ``NoneType``
242-
:param value: new description
241+
:type value: str
242+
:param value: (Optional) new description
243243
244244
:raises: ValueError for invalid value types.
245245
"""
@@ -260,8 +260,8 @@ def friendly_name(self):
260260
def friendly_name(self, value):
261261
"""Update title of the dataset.
262262
263-
:type value: str, or ``NoneType``
264-
:param value: new title
263+
:type value: str
264+
:param value: (Optional) new title
265265
266266
:raises: ValueError for invalid value types.
267267
"""
@@ -282,8 +282,8 @@ def location(self):
282282
def location(self, value):
283283
"""Update location in which the dataset is hosted.
284284
285-
:type value: str, or ``NoneType``
286-
:param value: new location
285+
:type value: str
286+
:param value: (Optional) new location
287287
288288
:raises: ValueError for invalid value types.
289289
"""

bigquery/google/cloud/bigquery/query.py

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -345,18 +345,19 @@ def fetch_data(self, max_results=None, page_token=None, start_index=None,
345345
See:
346346
https://cloud.google.com/bigquery/docs/reference/v2/jobs/getQueryResults
347347
348-
:type max_results: int or ``NoneType``
349-
:param max_results: maximum number of rows to return.
348+
:type max_results: int
349+
:param max_results: (Optional) maximum number of rows to return.
350350
351-
:type page_token: str or ``NoneType``
352-
:param page_token: token representing a cursor into the table's rows.
351+
:type page_token: str
352+
:param page_token:
353+
(Optional) token representing a cursor into the table's rows.
353354
354-
:type start_index: int or ``NoneType``
355-
:param start_index: zero-based index of starting row
355+
:type start_index: int
356+
:param start_index: (Optional) zero-based index of starting row
356357
357-
:type timeout_ms: int or ``NoneType``
358-
:param timeout_ms: timeout, in milliseconds, to wait for query to
359-
complete
358+
:type timeout_ms: int
359+
:param timeout_ms:
360+
(Optional) timeout, in milliseconds, to wait for query to complete
360361
361362
:type client: :class:`~google.cloud.bigquery.client.Client` or
362363
``NoneType``

bigquery/google/cloud/bigquery/table.py

Lines changed: 33 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -264,8 +264,8 @@ def description(self):
264264
def description(self, value):
265265
"""Update description of the table.
266266
267-
:type value: str, or ``NoneType``
268-
:param value: new description
267+
:type value: str
268+
:param value: (Optional) new description
269269
270270
:raises: ValueError for invalid value types.
271271
"""
@@ -289,8 +289,8 @@ def expires(self):
289289
def expires(self, value):
290290
"""Update datetime at which the table will be removed.
291291
292-
:type value: ``datetime.datetime``, or ``NoneType``
293-
:param value: the new expiration time, or None
292+
:type value: ``datetime.datetime``
293+
:param value: (Optional) the new expiration time, or None
294294
"""
295295
if not isinstance(value, datetime.datetime) and value is not None:
296296
raise ValueError("Pass a datetime, or None")
@@ -309,8 +309,8 @@ def friendly_name(self):
309309
def friendly_name(self, value):
310310
"""Update title of the table.
311311
312-
:type value: str, or ``NoneType``
313-
:param value: new title
312+
:type value: str
313+
:param value: (Optional) new title
314314
315315
:raises: ValueError for invalid value types.
316316
"""
@@ -331,8 +331,8 @@ def location(self):
331331
def location(self, value):
332332
"""Update location in which the table is hosted.
333333
334-
:type value: str, or ``NoneType``
335-
:param value: new location
334+
:type value: str
335+
:param value: (Optional) new location
336336
337337
:raises: ValueError for invalid value types.
338338
"""
@@ -554,17 +554,18 @@ def patch(self,
554554
:param client: the client to use. If not passed, falls back to the
555555
``client`` stored on the current dataset.
556556
557-
:type friendly_name: str or ``NoneType``
558-
:param friendly_name: point in time at which the table expires.
557+
:type friendly_name: str
558+
:param friendly_name: (Optional) a descriptive name for this table.
559559
560-
:type description: str or ``NoneType``
561-
:param description: point in time at which the table expires.
560+
:type description: str
561+
:param description: (Optional) a description of this table.
562562
563-
:type location: str or ``NoneType``
564-
:param location: point in time at which the table expires.
563+
:type location: str
564+
:param location:
565+
(Optional) the geographic location where the table resides.
565566
566-
:type expires: :class:`datetime.datetime` or ``NoneType``
567-
:param expires: point in time at which the table expires.
567+
:type expires: :class:`datetime.datetime`
568+
:param expires: (Optional) point in time at which the table expires.
568569
569570
:type view_query: str
570571
:param view_query: SQL query defining the table as a view
@@ -654,11 +655,12 @@ def fetch_data(self, max_results=None, page_token=None, client=None):
654655
incomplete. To ensure that the local copy of the schema is
655656
up-to-date, call the table's ``reload`` method.
656657
657-
:type max_results: int or ``NoneType``
658-
:param max_results: maximum number of rows to return.
658+
:type max_results: int
659+
:param max_results: (Optional) maximum number of rows to return.
659660
660-
:type page_token: str or ``NoneType``
661-
:param page_token: token representing a cursor into the table's rows.
661+
:type page_token: str
662+
:param page_token:
663+
(Optional) token representing a cursor into the table's rows.
662664
663665
:type client: :class:`~google.cloud.bigquery.client.Client` or
664666
``NoneType``
@@ -714,18 +716,18 @@ def insert_data(self,
714716
:param row_ids: Unique ids, one per row being inserted. If not
715717
passed, no de-duplication occurs.
716718
717-
:type skip_invalid_rows: bool or ``NoneType``
718-
:param skip_invalid_rows: skip rows w/ invalid data?
719+
:type skip_invalid_rows: bool
720+
:param skip_invalid_rows: (Optional) skip rows w/ invalid data?
719721
720-
:type ignore_unknown_values: bool or ``NoneType``
721-
:param ignore_unknown_values: ignore columns beyond schema?
722-
723-
:type template_suffix: str or ``NoneType``
724-
:param template_suffix: treat ``name`` as a template table and provide
725-
a suffix. BigQuery will create the table
726-
``<name> + <template_suffix>`` based on the
727-
schema of the template table. See:
728-
https://cloud.google.com/bigquery/streaming-data-into-bigquery#template-tables
722+
:type ignore_unknown_values: bool
723+
:param ignore_unknown_values: (Optional) ignore columns beyond schema?
724+
725+
:type template_suffix: str
726+
:param template_suffix:
727+
(Optional) treat ``name`` as a template table and provide a suffix.
728+
BigQuery will create the table ``<name> + <template_suffix>`` based
729+
on the schema of the template table. See:
730+
https://cloud.google.com/bigquery/streaming-data-into-bigquery#template-tables
729731
730732
:type client: :class:`~google.cloud.bigquery.client.Client` or
731733
``NoneType``

core/google/cloud/_helpers.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -366,8 +366,8 @@ def _microseconds_from_datetime(value):
366366
def _millis_from_datetime(value):
367367
"""Convert non-none datetime to timestamp, assuming UTC.
368368
369-
:type value: :class:`datetime.datetime`, or None
370-
:param value: the timestamp
369+
:type value: :class:`datetime.datetime`
370+
:param value: (Optional) the timestamp
371371
372372
:rtype: int, or ``NoneType``
373373
:returns: the timestamp, in milliseconds, or None
@@ -554,8 +554,8 @@ def _name_from_project_path(path, project, template):
554554
:type path: str
555555
:param path: URI path containing the name.
556556
557-
:type project: str or NoneType
558-
:param project: The project associated with the request. It is
557+
:type project: str
558+
:param project: (Optional) The project associated with the request. It is
559559
included for validation purposes. If passed as None,
560560
disables validation.
561561

core/google/cloud/connection.py

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -214,11 +214,11 @@ def _make_request(self, method, url, data=None, content_type=None,
214214
:type headers: dict
215215
:param headers: A dictionary of HTTP headers to send with the request.
216216
217-
:type target_object: object or :class:`NoneType`
218-
:param target_object: Argument to be used by library callers.
219-
This can allow custom behavior, for example, to
220-
defer an HTTP request and complete initialization
221-
of the object at a later time.
217+
:type target_object: object
218+
:param target_object:
219+
(Optional) Argument to be used by library callers. This can allow
220+
custom behavior, for example, to defer an HTTP request and complete
221+
initialization of the object at a later time.
222222
223223
:rtype: tuple of ``response`` (a dictionary of sorts)
224224
and ``content`` (a string).
@@ -261,9 +261,10 @@ def _do_request(self, method, url, headers, data,
261261
:type data: str
262262
:param data: The data to send as the body of the request.
263263
264-
:type target_object: object or :class:`NoneType`
265-
:param target_object: Unused ``target_object`` here but may be used
266-
by a superclass.
264+
:type target_object: object
265+
:param target_object:
266+
(Optional) Unused ``target_object`` here but may be used by a
267+
superclass.
267268
268269
:rtype: tuple of ``response`` (a dictionary of sorts)
269270
and ``content`` (a string).
@@ -323,11 +324,11 @@ def api_request(self, method, path, query_params=None,
323324
response as JSON and raise an exception if
324325
that cannot be done. Default is True.
325326
326-
:type _target_object: :class:`object` or :class:`NoneType`
327-
:param _target_object: Protected argument to be used by library
328-
callers. This can allow custom behavior, for
329-
example, to defer an HTTP request and complete
330-
initialization of the object at a later time.
327+
:type _target_object: :class:`object`
328+
:param _target_object:
329+
(Optional) Protected argument to be used by library callers. This
330+
can allow custom behavior, for example, to defer an HTTP request
331+
and complete initialization of the object at a later time.
331332
332333
:raises: Exception if the response code is not 200 OK.
333334
:rtype: dict or str

core/google/cloud/streaming/buffered_stream.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,10 @@ def _bytes_remaining(self):
8181
def read(self, size=None):
8282
"""Read bytes from the buffer.
8383
84-
:type size: int or None
85-
:param size: How many bytes to read (defaults to all remaining bytes).
84+
:type size: int
85+
:param size:
86+
(Optional) How many bytes to read (defaults to all remaining
87+
bytes).
8688
8789
:rtype: str
8890
:returns: The data read from the stream.

core/google/cloud/streaming/http_wrapper.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,9 @@ def _httplib2_debug_level(http_request, level, http=None):
8080
:type level: int
8181
:param level: the debuglevel for logging.
8282
83-
:type http: :class:`httplib2.Http`, or ``None``
84-
:param http: the instance on whose connections to set the debuglevel.
83+
:type http: :class:`httplib2.Http`
84+
:param http:
85+
(Optional) the instance on whose connections to set the debuglevel.
8586
"""
8687
if http_request.loggable_body is None:
8788
yield
@@ -115,8 +116,8 @@ class Request(object):
115116
:type http_method: str
116117
:param http_method: the HTTP method to use for the request
117118
118-
:type headers: mapping or None
119-
:param headers: headers to be sent with the request
119+
:type headers: mapping
120+
:param headers: (Optional) headers to be sent with the request
120121
121122
:type body: str
122123
:param body: body to be sent with the request

core/google/cloud/streaming/stream_slice.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,10 @@ def read(self, size=None):
6565
slice indicates we should still be able to read more bytes, we
6666
raise :exc:`IncompleteRead`.
6767
68-
:type size: int or None
69-
:param size: If provided, read no more than size bytes from the stream.
68+
:type size: int
69+
:param size:
70+
(Optional) If provided, read no more than size bytes from the
71+
stream.
7072
7173
:rtype: bytes
7274
:returns: bytes read from this slice.

0 commit comments

Comments
 (0)