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

docs: pass explicit 'client' in '{Blob.Bucket}.from_string' examples #545

Merged
merged 3 commits into from
Aug 20, 2021
Merged
Show file tree
Hide file tree
Changes from 2 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
6 changes: 3 additions & 3 deletions google/cloud/storage/blob.py
Original file line number Diff line number Diff line change
Expand Up @@ -393,8 +393,8 @@ def from_string(cls, uri, client=None):

:type client: :class:`~google.cloud.storage.client.Client`
:param client:
(Optional) The client to use. If not passed, falls back to the
``client`` stored on the blob's bucket.
(Optional) The client to use. Application code should
*always* pass ``client``.

:rtype: :class:`google.cloud.storage.blob.Blob`
:returns: The blob object created.
Expand All @@ -405,7 +405,7 @@ def from_string(cls, uri, client=None):
>>> from google.cloud import storage
>>> from google.cloud.storage.blob import Blob
>>> client = storage.Client()
>>> blob = Blob.from_string("gs://bucket/object")
>>> blob = Blob.from_string("gs://bucket/object", client=client)
"""
from google.cloud.storage.bucket import Bucket

Expand Down
5 changes: 3 additions & 2 deletions google/cloud/storage/bucket.py
Original file line number Diff line number Diff line change
Expand Up @@ -656,7 +656,8 @@ def from_string(cls, uri, client=None):

:type client: :class:`~google.cloud.storage.client.Client` or
``NoneType``
:param client: (Optional) The client to use.
:param client: (Optional) The client to use. Application code should
*always* pass ``client``.

:rtype: :class:`google.cloud.storage.bucket.Bucket`
:returns: The bucket object created.
Expand All @@ -667,7 +668,7 @@ def from_string(cls, uri, client=None):
>>> from google.cloud import storage
>>> from google.cloud.storage.bucket import Bucket
>>> client = storage.Client()
>>> bucket = Bucket.from_string("gs://bucket", client)
>>> bucket = Bucket.from_string("gs://bucket", client=client)
"""
scheme, netloc, path, query, frag = urlsplit(uri)

Expand Down