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/google-cloud-python#2580 (review)
  • Loading branch information
tswast committed Oct 21, 2016
1 parent 0a6edf8 commit f9142ca
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 38 deletions.
8 changes: 4 additions & 4 deletions 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 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 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 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 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 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

0 comments on commit f9142ca

Please sign in to comment.