Description
In this function docs returns part says returns The blob that was just deleted. but actually self.bucket.delete_blob didn't return anything and rtype also not Blob but None.
I'm not sure the fault is that Blob.delete return unnecessary or Bucket.delete_blob didn't return after blob api_request.
Blob
https://github.com/googleapis/google-cloud-python/blob/master/storage/google/cloud/storage/blob.py#L548
defdelete(self, client=None):
"""Deletes a blob from Cloud Storage. If :attr:`user_project` is set on the bucket, bills the API request to that project. :type client: :class:`~google.cloud.storage.client.Client` or ``NoneType`` :param client: Optional. The client to use. If not passed, falls back to the ``client`` stored on the blob's bucket. :rtype: :class:`Blob` :returns: The blob that was just deleted. :raises: :class:`google.cloud.exceptions.NotFound` (propagated from :meth:`google.cloud.storage.bucket.Bucket.delete_blob`). """returnself.bucket.delete_blob(
self.name, client=client, generation=self.generation
)
Bucket
https://github.com/googleapis/google-cloud-python/blob/master/storage/google/cloud/storage/bucket.py#L1055
defdelete_blob(self, blob_name, client=None, generation=None):
"""Deletes a blob from the current bucket. If the blob isn't found (backend 404), raises a :class:`google.cloud.exceptions.NotFound`. For example: .. literalinclude:: snippets.py :start-after: [START delete_blob] :end-before: [END delete_blob] If :attr:`user_project` is set, bills the API request to that project. :type blob_name: str :param blob_name: A blob name to delete. :type client: :class:`~google.cloud.storage.client.Client` or ``NoneType`` :param client: Optional. The client to use. If not passed, falls back to the ``client`` stored on the current bucket. :type generation: long :param generation: Optional. If present, permanently deletes a specific revision of this object. :raises: :class:`google.cloud.exceptions.NotFound` (to suppress the exception, call ``delete_blobs``, passing a no-op ``on_error`` callback, e.g.: .. literalinclude:: snippets.py :start-after: [START delete_blobs] :end-before: [END delete_blobs] """client=self._require_client(client)
blob=Blob(blob_name, bucket=self, generation=generation)
# We intentionally pass `_target_object=None` since a DELETE# request has no response value (whether in a standard request or# in a batch request).client._connection.api_request(
method="DELETE",
path=blob.path,
query_params=blob._query_params,
_target_object=None,
)
Description
In this function docs returns part says returns
The blob that was just deleted.but actuallyself.bucket.delete_blobdidn't return anything andrtypealso notBlobbutNone.I'm not sure the fault is that
Blob.deletereturn unnecessary orBucket.delete_blobdidn't return afterblobapi_request.Blob
https://github.com/googleapis/google-cloud-python/blob/master/storage/google/cloud/storage/blob.py#L548
Bucket
https://github.com/googleapis/google-cloud-python/blob/master/storage/google/cloud/storage/bucket.py#L1055