Skip to content

Commit aa4f282

Browse files
MiaCYandrewsg
andauthored
feat: un-deprecate blob.download_to_file(), bucket.create(), and bucket.list_blobs() (#1013)
Long-term plans to deprecate and remove these methods have changed. Co-authored-by: Andrew Gorcester <[email protected]>
1 parent 47228ec commit aa4f282

File tree

3 files changed

+5
-33
lines changed

3 files changed

+5
-33
lines changed

google/cloud/storage/blob.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1024,7 +1024,7 @@ def download_to_file(
10241024
checksum="md5",
10251025
retry=DEFAULT_RETRY,
10261026
):
1027-
"""DEPRECATED. Download the contents of this blob into a file-like object.
1027+
"""Download the contents of this blob into a file-like object.
10281028
10291029
.. note::
10301030

google/cloud/storage/bucket.py

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -922,10 +922,7 @@ def create(
922922
timeout=_DEFAULT_TIMEOUT,
923923
retry=DEFAULT_RETRY,
924924
):
925-
"""DEPRECATED. Creates current bucket.
926-
927-
.. note::
928-
Direct use of this method is deprecated. Use ``Client.create_bucket()`` instead.
925+
"""Creates current bucket.
929926
930927
If the bucket already exists, will raise
931928
:class:`google.cloud.exceptions.Conflict`.
@@ -970,12 +967,6 @@ def create(
970967
:param retry:
971968
(Optional) How to retry the RPC. See: :ref:`configuring_retries`
972969
"""
973-
warnings.warn(
974-
"Bucket.create() is deprecated and will be removed in future."
975-
"Use Client.create_bucket() instead.",
976-
PendingDeprecationWarning,
977-
stacklevel=1,
978-
)
979970

980971
client = self._require_client(client)
981972
client.create_bucket(
@@ -1300,10 +1291,7 @@ def list_blobs(
13001291
timeout=_DEFAULT_TIMEOUT,
13011292
retry=DEFAULT_RETRY,
13021293
):
1303-
"""DEPRECATED. Return an iterator used to find blobs in the bucket.
1304-
1305-
.. note::
1306-
Direct use of this method is deprecated. Use ``Client.list_blobs`` instead.
1294+
"""Return an iterator used to find blobs in the bucket.
13071295
13081296
If :attr:`user_project` is set, bills the API request to that project.
13091297

tests/unit/test_bucket.py

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2946,8 +2946,7 @@ def test_versioning_enabled_getter(self):
29462946
bucket = self._make_one(name=NAME, properties=before)
29472947
self.assertEqual(bucket.versioning_enabled, True)
29482948

2949-
@mock.patch("warnings.warn")
2950-
def test_create_w_defaults_deprecated(self, mock_warn):
2949+
def test_create_w_defaults(self):
29512950
bucket_name = "bucket-name"
29522951
api_response = {"name": bucket_name}
29532952
client = mock.Mock(spec=["create_bucket"])
@@ -2967,15 +2966,7 @@ def test_create_w_defaults_deprecated(self, mock_warn):
29672966
retry=DEFAULT_RETRY,
29682967
)
29692968

2970-
mock_warn.assert_called_with(
2971-
"Bucket.create() is deprecated and will be removed in future."
2972-
"Use Client.create_bucket() instead.",
2973-
PendingDeprecationWarning,
2974-
stacklevel=1,
2975-
)
2976-
2977-
@mock.patch("warnings.warn")
2978-
def test_create_w_explicit_deprecated(self, mock_warn):
2969+
def test_create_w_explicit(self):
29792970
project = "PROJECT"
29802971
location = "eu"
29812972
user_project = "USER_PROJECT"
@@ -3011,13 +3002,6 @@ def test_create_w_explicit_deprecated(self, mock_warn):
30113002
retry=retry,
30123003
)
30133004

3014-
mock_warn.assert_called_with(
3015-
"Bucket.create() is deprecated and will be removed in future."
3016-
"Use Client.create_bucket() instead.",
3017-
PendingDeprecationWarning,
3018-
stacklevel=1,
3019-
)
3020-
30213005
def test_versioning_enabled_setter(self):
30223006
NAME = "name"
30233007
bucket = self._make_one(name=NAME)

0 commit comments

Comments
 (0)