Skip to content

Commit f9142ca

Browse files
committed
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: googleapis/google-cloud-python#2580 (review)
1 parent 0a6edf8 commit f9142ca

File tree

6 files changed

+38
-38
lines changed

6 files changed

+38
-38
lines changed

google/cloud/_helpers.py

+4-4
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

google/cloud/connection.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -214,8 +214,8 @@ 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.
217+
:type target_object: object
218+
:param target_object: (Optional) Argument to be used by library callers.
219219
This can allow custom behavior, for example, to
220220
defer an HTTP request and complete initialization
221221
of the object at a later time.
@@ -261,8 +261,8 @@ 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
264+
:type target_object: object
265+
:param target_object: (Optional) Unused ``target_object`` here but may be used
266266
by a superclass.
267267
268268
:rtype: tuple of ``response`` (a dictionary of sorts)
@@ -323,8 +323,8 @@ def api_request(self, method, path, query_params=None,
323323
response as JSON and raise an exception if
324324
that cannot be done. Default is True.
325325
326-
:type _target_object: :class:`object` or :class:`NoneType`
327-
:param _target_object: Protected argument to be used by library
326+
:type _target_object: :class:`object`
327+
:param _target_object: (Optional) Protected argument to be used by library
328328
callers. This can allow custom behavior, for
329329
example, to defer an HTTP request and complete
330330
initialization of the object at a later time.

google/cloud/streaming/buffered_stream.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,8 @@ 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: (Optional) How many bytes to read (defaults to all remaining bytes).
8686
8787
:rtype: str
8888
:returns: The data read from the stream.

google/cloud/streaming/http_wrapper.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,8 @@ 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: (Optional) the instance on whose connections to set the debuglevel.
8585
"""
8686
if http_request.loggable_body is None:
8787
yield
@@ -115,8 +115,8 @@ class Request(object):
115115
:type http_method: str
116116
:param http_method: the HTTP method to use for the request
117117
118-
:type headers: mapping or None
119-
:param headers: headers to be sent with the request
118+
:type headers: mapping
119+
:param headers: (Optional) headers to be sent with the request
120120
121121
:type body: str
122122
:param body: body to be sent with the request

google/cloud/streaming/stream_slice.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,8 @@ 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: (Optional) If provided, read no more than size bytes from the stream.
7070
7171
:rtype: bytes
7272
:returns: bytes read from this slice.

google/cloud/streaming/transfer.py

+20-20
Original file line numberDiff line numberDiff line change
@@ -280,8 +280,8 @@ def from_stream(cls, stream, auto_transfer=True, total_size=None, **kwds):
280280
:type stream: writable file-like object
281281
:param stream: the target file
282282
283-
:type total_size: int or None
284-
:param total_size: total size of the file to be downloaded
283+
:type total_size: int
284+
:param total_size: (Optional) total size of the file to be downloaded
285285
286286
:type auto_transfer: bool
287287
:param auto_transfer: should the transfer be started immediately
@@ -457,8 +457,8 @@ def _compute_end_byte(self, start, end=None, use_chunks=True):
457457
:type start: int
458458
:param start: start byte of the range.
459459
460-
:type end: int or None
461-
:param end: suggested last byte of the range.
460+
:type end: int
461+
:param end: (Optional) suggested last byte of the range.
462462
463463
:type use_chunks: bool
464464
:param use_chunks: If False, ignore :attr:`chunksize`.
@@ -493,8 +493,8 @@ def _get_chunk(self, start, end):
493493
:type start: int
494494
:param start: start byte of the range.
495495
496-
:type end: int or None
497-
:param end: end byte of the range.
496+
:type end: int
497+
:param end: (Optional) end byte of the range.
498498
499499
:rtype: :class:`google.cloud.streaming.http_wrapper.Response`
500500
:returns: response from the chunk request.
@@ -555,8 +555,8 @@ def get_range(self, start, end=None, use_chunks=True):
555555
:type start: int
556556
:param start: Where to start fetching bytes. (See above.)
557557
558-
:type end: int or ``None``
559-
:param end: Where to stop fetching bytes. (See above.)
558+
:type end: int
559+
:param end: (Optional) Where to stop fetching bytes. (See above.)
560560
561561
:type use_chunks: bool
562562
:param use_chunks: If False, ignore :attr:`chunksize`
@@ -625,8 +625,8 @@ class Upload(_Transfer):
625625
:type mime_type: str:
626626
:param mime_type: MIME type of the upload.
627627
628-
:type total_size: int or None
629-
:param total_size: Total upload size for the stream.
628+
:type total_size: int
629+
:param total_size: (Optional) Total upload size for the stream.
630630
631631
:type http: :class:`httplib2.Http` (or workalike)
632632
:param http: Http instance used to perform requests.
@@ -669,8 +669,8 @@ def from_file(cls, filename, mime_type=None, auto_transfer=True, **kwds):
669669
:type mime_type: str
670670
:param mime_type: MIMEtype of the file being uploaded
671671
672-
:type auto_transfer: bool or None
673-
:param auto_transfer: should the transfer be started immediately
672+
:type auto_transfer: bool
673+
:param auto_transfer: (Optional) should the transfer be started immediately
674674
675675
:type kwds: dict
676676
:param kwds: keyword arguments: passed
@@ -700,11 +700,11 @@ def from_stream(cls, stream, mime_type,
700700
:type mime_type: str
701701
:param mime_type: MIMEtype of the file being uploaded
702702
703-
:type total_size: int or None
704-
:param total_size: Size of the file being uploaded
703+
:type total_size: int
704+
:param total_size: (Optional) Size of the file being uploaded
705705
706-
:type auto_transfer: bool or None
707-
:param auto_transfer: should the transfer be started immediately
706+
:type auto_transfer: bool
707+
:param auto_transfer: (Optional) should the transfer be started immediately
708708
709709
:type kwds: dict
710710
:param kwds: keyword arguments: passed
@@ -784,8 +784,8 @@ def total_size(self):
784784
def total_size(self, value):
785785
"""Update total size of the stream to be uploaded.
786786
787-
:type value: int or None
788-
:param value: the size
787+
:type value: int
788+
:param value: (Optional) the size
789789
"""
790790
self._ensure_uninitialized()
791791
self._total_size = value
@@ -1048,8 +1048,8 @@ def _validate_chunksize(self, chunksize=None):
10481048
10491049
Helper for :meth:`stream_file`.
10501050
1051-
:type chunksize: int or None
1052-
:param chunksize: the chunk size to be tested.
1051+
:type chunksize: int
1052+
:param chunksize: (Optional) the chunk size to be tested.
10531053
10541054
:raises: :exc:`ValueError` if ``chunksize`` is not a multiple
10551055
of the server-specified granulariy.

0 commit comments

Comments
 (0)