Skip to content
This repository was archived by the owner on Mar 31, 2026. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
delete "more than one set" checks
  • Loading branch information
IlyaFaer committed May 5, 2020
commit 1f4d9c14a03599020d514e7a88f0dff4a9dd2254
62 changes: 0 additions & 62 deletions google/cloud/storage/blob.py
Original file line number Diff line number Diff line change
Expand Up @@ -762,20 +762,7 @@ def _get_download_url(

:rtype: str
:returns: The download URL for the current blob.

:raises: :class:`ValueError` if ``if_metageneration_match`` and
``if_metageneration_not_match``, or
``if_generation_match`` and ``if_generation_not_match``
are both set.
"""
_raise_for_more_than_one_none(
if_generation_match=if_generation_match,
if_generation_not_match=if_generation_not_match,
)
_raise_for_more_than_one_none(
if_metageneration_match=if_metageneration_match,
if_metageneration_not_match=if_metageneration_not_match,
)
name_value_pairs = []
if self.media_link is None:
base_url = _DOWNLOAD_URL_TEMPLATE.format(
Expand Down Expand Up @@ -943,11 +930,6 @@ def download_to_file(
blob's current metageneration does not match the given value.

:raises: :class:`google.cloud.exceptions.NotFound`

:raises: :class:`ValueError` if ``if_metageneration_match`` and
``if_metageneration_not_match``, or
``if_generation_match`` and ``if_generation_not_match``
are both set.
"""
client = self._require_client(client)

Expand Down Expand Up @@ -1025,11 +1007,6 @@ def download_to_filename(
blob's current metageneration does not match the given value.

:raises: :class:`google.cloud.exceptions.NotFound`

:raises: :class:`ValueError` if ``if_metageneration_match`` and
``if_metageneration_not_match``, or
``if_generation_match`` and ``if_generation_not_match``
are both set.
"""
try:
with open(filename, "wb") as file_obj:
Expand Down Expand Up @@ -1112,11 +1089,6 @@ def download_as_string(
:returns: The data stored in this blob.

:raises: :class:`google.cloud.exceptions.NotFound`

:raises: :class:`ValueError` if ``if_metageneration_match`` and
``if_metageneration_not_match``, or
``if_generation_match`` and ``if_generation_not_match``
are both set.
"""
string_buffer = BytesIO()
self.download_to_file(
Expand Down Expand Up @@ -2390,32 +2362,7 @@ def rewrite(
``bytes_rewritten`` is the number of bytes rewritten so far,
and ``total_bytes`` is the total number of bytes to be
rewritten.

:raises: :class:`ValueError` if ``if_metageneration_match`` and
``if_metageneration_not_match``, or
``if_generation_match`` and ``if_generation_not_match``,
or ``if_source_generation_match`` and
``if_source_generation_not_match``, or
``if_source_metageneration_match`` and
``if_source_metageneration_not_match``
are both set.
"""
_raise_for_more_than_one_none(
if_generation_match=if_generation_match,
if_generation_not_match=if_generation_not_match,
)
_raise_for_more_than_one_none(
if_metageneration_match=if_metageneration_match,
if_metageneration_not_match=if_metageneration_not_match,
)
_raise_for_more_than_one_none(
if_source_generation_match=if_source_generation_match,
if_source_generation_not_match=if_source_generation_not_match,
)
_raise_for_more_than_one_none(
if_source_metageneration_match=if_source_metageneration_match,
if_source_metageneration_not_match=if_source_metageneration_not_match,
)
client = self._require_client(client)
headers = _get_encryption_headers(self._encryption_key)
headers.update(_get_encryption_headers(source._encryption_key, source=True))
Expand Down Expand Up @@ -2560,15 +2507,6 @@ def update_storage_class(
conditional on whether the source
object's current metageneration
does not match the given value.

:raises: :class:`ValueError` if ``if_metageneration_match`` and
``if_metageneration_not_match``, or
``if_generation_match`` and ``if_generation_not_match``,
or ``if_source_generation_match`` and
``if_source_generation_not_match``, or
``if_source_metageneration_match`` and
``if_source_metageneration_not_match``
are both set.
"""
if new_class not in self.STORAGE_CLASSES:
raise ValueError("Invalid storage class: %s" % (new_class,))
Expand Down
25 changes: 0 additions & 25 deletions google/cloud/storage/bucket.py
Original file line number Diff line number Diff line change
Expand Up @@ -1485,15 +1485,6 @@ def copy_blob(
:rtype: :class:`google.cloud.storage.blob.Blob`
:returns: The new Blob.

:raises: :class:`ValueError` if ``if_metageneration_match`` and
``if_metageneration_not_match``, or
``if_generation_match`` and ``if_generation_not_match``,
or ``if_source_generation_match`` and
``if_source_generation_not_match``, or
``if_source_metageneration_match`` and
``if_source_metageneration_not_match``
are both set.

Example:
Copy a blob including ACL.

Expand All @@ -1508,22 +1499,6 @@ def copy_blob(
>>> new_blob = bucket.copy_blob(blob, dst_bucket)
>>> new_blob.acl.save(blob.acl)
"""
_raise_for_more_than_one_none(
if_generation_match=if_generation_match,
if_generation_not_match=if_generation_not_match,
)
_raise_for_more_than_one_none(
if_metageneration_match=if_metageneration_match,
if_metageneration_not_match=if_metageneration_not_match,
)
_raise_for_more_than_one_none(
if_source_generation_match=if_source_generation_match,
if_source_generation_not_match=if_source_generation_not_match,
)
_raise_for_more_than_one_none(
if_source_metageneration_match=if_source_metageneration_match,
if_source_metageneration_not_match=if_source_metageneration_not_match,
)
client = self._require_client(client)
query_params = {}

Expand Down