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

fix: from_string method of blob and bucket class #290

Merged
merged 7 commits into from Nov 11, 2020
4 changes: 2 additions & 2 deletions google/cloud/storage/blob.py
Expand Up @@ -330,15 +330,15 @@ def public_url(self):
)

@classmethod
def from_string(cls, uri, client=None):
def from_string(cls, uri, client):
tseaver marked this conversation as resolved.
Show resolved Hide resolved
"""Get a constructor for blob object by URI.

:type uri: str
:param uri: The blob uri pass to get blob object.

:type client: :class:`~google.cloud.storage.client.Client` or
``NoneType``
:param client: (Optional) The client to use.
:param client: The client to use.

:rtype: :class:`google.cloud.storage.blob.Blob`
:returns: The blob object created.
Expand Down
4 changes: 2 additions & 2 deletions google/cloud/storage/bucket.py
Expand Up @@ -612,15 +612,15 @@ def user_project(self):
return self._user_project

@classmethod
def from_string(cls, uri, client=None):
def from_string(cls, uri, client):
"""Get a constructor for bucket object by URI.

:type uri: str
:param uri: The bucket uri pass to get bucket object.

:type client: :class:`~google.cloud.storage.client.Client` or
``NoneType``
:param client: (Optional) The client to use.
:param client: The client to use.

:rtype: :class:`google.cloud.storage.bucket.Bucket`
:returns: The bucket object created.
Expand Down
2 changes: 1 addition & 1 deletion google/cloud/storage/client.py
Expand Up @@ -579,7 +579,7 @@ def download_blob_to_file(self, blob_or_uri, file_obj, start=None, end=None):
try:
blob_or_uri.download_to_file(file_obj, client=self, start=start, end=end)
except AttributeError:
blob = Blob.from_string(blob_or_uri)
blob = Blob.from_string(blob_or_uri, self)
blob.download_to_file(file_obj, client=self, start=start, end=end)

def list_blobs(
Expand Down