59
59
from google .cloud .storage ._helpers import _get_default_storage_base_url
60
60
from google .cloud .storage ._signing import generate_signed_url_v2
61
61
from google .cloud .storage ._signing import generate_signed_url_v4
62
- from google .cloud .storage ._helpers import _NUM_RETRIES_MESSAGE
63
62
from google .cloud .storage ._helpers import _API_VERSION
64
63
from google .cloud .storage ._helpers import _virtual_hosted_style_base_url
65
64
from google .cloud .storage .acl import ACL
@@ -1829,7 +1828,6 @@ def _do_multipart_upload(
1829
1828
stream ,
1830
1829
content_type ,
1831
1830
size ,
1832
- num_retries ,
1833
1831
predefined_acl ,
1834
1832
if_generation_match ,
1835
1833
if_generation_not_match ,
@@ -1866,15 +1864,6 @@ def _do_multipart_upload(
1866
1864
``stream``). If not provided, the upload will be concluded once
1867
1865
``stream`` is exhausted (or :data:`None`).
1868
1866
1869
- :type num_retries: int
1870
- :param num_retries:
1871
- Number of upload retries. By default, only uploads with
1872
- if_generation_match set will be retried, as uploads without the
1873
- argument are not guaranteed to be idempotent. Setting num_retries
1874
- will override this default behavior and guarantee retries even when
1875
- if_generation_match is not set. (Deprecated: This argument
1876
- will be removed in a future release.)
1877
-
1878
1867
:type predefined_acl: str
1879
1868
:param predefined_acl: (Optional) Predefined access control list
1880
1869
@@ -1989,9 +1978,7 @@ def _do_multipart_upload(
1989
1978
upload_url = _add_query_parameters (base_url , name_value_pairs )
1990
1979
upload = MultipartUpload (upload_url , headers = headers , checksum = checksum )
1991
1980
1992
- upload ._retry_strategy = _api_core_retry_to_resumable_media_retry (
1993
- retry , num_retries
1994
- )
1981
+ upload ._retry_strategy = _api_core_retry_to_resumable_media_retry (retry )
1995
1982
1996
1983
response = upload .transmit (
1997
1984
transport , data , object_metadata , content_type , timeout = timeout
@@ -2005,7 +1992,6 @@ def _initiate_resumable_upload(
2005
1992
stream ,
2006
1993
content_type ,
2007
1994
size ,
2008
- num_retries ,
2009
1995
predefined_acl = None ,
2010
1996
extra_headers = None ,
2011
1997
chunk_size = None ,
@@ -2047,15 +2033,6 @@ def _initiate_resumable_upload(
2047
2033
:type predefined_acl: str
2048
2034
:param predefined_acl: (Optional) Predefined access control list
2049
2035
2050
- :type num_retries: int
2051
- :param num_retries:
2052
- Number of upload retries. By default, only uploads with
2053
- if_generation_match set will be retried, as uploads without the
2054
- argument are not guaranteed to be idempotent. Setting num_retries
2055
- will override this default behavior and guarantee retries even when
2056
- if_generation_match is not set. (Deprecated: This argument
2057
- will be removed in a future release.)
2058
-
2059
2036
:type extra_headers: dict
2060
2037
:param extra_headers:
2061
2038
(Optional) Extra headers to add to standard headers.
@@ -2185,9 +2162,7 @@ def _initiate_resumable_upload(
2185
2162
upload_url , chunk_size , headers = headers , checksum = checksum
2186
2163
)
2187
2164
2188
- upload ._retry_strategy = _api_core_retry_to_resumable_media_retry (
2189
- retry , num_retries
2190
- )
2165
+ upload ._retry_strategy = _api_core_retry_to_resumable_media_retry (retry )
2191
2166
2192
2167
upload .initiate (
2193
2168
transport ,
@@ -2207,7 +2182,6 @@ def _do_resumable_upload(
2207
2182
stream ,
2208
2183
content_type ,
2209
2184
size ,
2210
- num_retries ,
2211
2185
predefined_acl ,
2212
2186
if_generation_match ,
2213
2187
if_generation_not_match ,
@@ -2247,15 +2221,6 @@ def _do_resumable_upload(
2247
2221
``stream``). If not provided, the upload will be concluded once
2248
2222
``stream`` is exhausted (or :data:`None`).
2249
2223
2250
- :type num_retries: int
2251
- :param num_retries:
2252
- Number of upload retries. By default, only uploads with
2253
- if_generation_match set will be retried, as uploads without the
2254
- argument are not guaranteed to be idempotent. Setting num_retries
2255
- will override this default behavior and guarantee retries even when
2256
- if_generation_match is not set. (Deprecated: This argument
2257
- will be removed in a future release.)
2258
-
2259
2224
:type predefined_acl: str
2260
2225
:param predefined_acl: (Optional) Predefined access control list
2261
2226
@@ -2320,7 +2285,6 @@ def _do_resumable_upload(
2320
2285
stream ,
2321
2286
content_type ,
2322
2287
size ,
2323
- num_retries ,
2324
2288
predefined_acl = predefined_acl ,
2325
2289
if_generation_match = if_generation_match ,
2326
2290
if_generation_not_match = if_generation_not_match ,
@@ -2346,7 +2310,6 @@ def _do_upload(
2346
2310
stream ,
2347
2311
content_type ,
2348
2312
size ,
2349
- num_retries ,
2350
2313
predefined_acl ,
2351
2314
if_generation_match ,
2352
2315
if_generation_not_match ,
@@ -2387,15 +2350,6 @@ def _do_upload(
2387
2350
``stream``). If not provided, the upload will be concluded once
2388
2351
``stream`` is exhausted (or :data:`None`).
2389
2352
2390
- :type num_retries: int
2391
- :param num_retries:
2392
- Number of upload retries. By default, only uploads with
2393
- if_generation_match set will be retried, as uploads without the
2394
- argument are not guaranteed to be idempotent. Setting num_retries
2395
- will override this default behavior and guarantee retries even when
2396
- if_generation_match is not set. (Deprecated: This argument
2397
- will be removed in a future release.)
2398
-
2399
2353
:type predefined_acl: str
2400
2354
:param predefined_acl: (Optional) Predefined access control list
2401
2355
@@ -2485,7 +2439,6 @@ def _do_upload(
2485
2439
stream ,
2486
2440
content_type ,
2487
2441
size ,
2488
- num_retries ,
2489
2442
predefined_acl ,
2490
2443
if_generation_match ,
2491
2444
if_generation_not_match ,
@@ -2502,7 +2455,6 @@ def _do_upload(
2502
2455
stream ,
2503
2456
content_type ,
2504
2457
size ,
2505
- num_retries ,
2506
2458
predefined_acl ,
2507
2459
if_generation_match ,
2508
2460
if_generation_not_match ,
@@ -2522,7 +2474,6 @@ def _prep_and_do_upload(
2522
2474
rewind = False ,
2523
2475
size = None ,
2524
2476
content_type = None ,
2525
- num_retries = None ,
2526
2477
client = None ,
2527
2478
predefined_acl = None ,
2528
2479
if_generation_match = None ,
@@ -2580,15 +2531,6 @@ def _prep_and_do_upload(
2580
2531
:type content_type: str
2581
2532
:param content_type: (Optional) Type of content being uploaded.
2582
2533
2583
- :type num_retries: int
2584
- :param num_retries:
2585
- Number of upload retries. By default, only uploads with
2586
- if_generation_match set will be retried, as uploads without the
2587
- argument are not guaranteed to be idempotent. Setting num_retries
2588
- will override this default behavior and guarantee retries even when
2589
- if_generation_match is not set. (Deprecated: This argument
2590
- will be removed in a future release.)
2591
-
2592
2534
:type client: :class:`~google.cloud.storage.client.Client`
2593
2535
:param client:
2594
2536
(Optional) The client to use. If not passed, falls back to the
@@ -2662,14 +2604,6 @@ def _prep_and_do_upload(
2662
2604
:raises: :class:`~google.cloud.exceptions.GoogleCloudError`
2663
2605
if the upload response returns an error status.
2664
2606
"""
2665
- if num_retries is not None :
2666
- warnings .warn (_NUM_RETRIES_MESSAGE , DeprecationWarning , stacklevel = 2 )
2667
- # num_retries and retry are mutually exclusive. If num_retries is
2668
- # set and retry is exactly the default, then nullify retry for
2669
- # backwards compatibility.
2670
- if retry is DEFAULT_RETRY_IF_GENERATION_SPECIFIED :
2671
- retry = None
2672
-
2673
2607
_maybe_rewind (file_obj , rewind = rewind )
2674
2608
predefined_acl = ACL .validate_predefined (predefined_acl )
2675
2609
@@ -2679,7 +2613,6 @@ def _prep_and_do_upload(
2679
2613
file_obj ,
2680
2614
content_type ,
2681
2615
size ,
2682
- num_retries ,
2683
2616
predefined_acl ,
2684
2617
if_generation_match ,
2685
2618
if_generation_not_match ,
@@ -2700,7 +2633,6 @@ def upload_from_file(
2700
2633
rewind = False ,
2701
2634
size = None ,
2702
2635
content_type = None ,
2703
- num_retries = None ,
2704
2636
client = None ,
2705
2637
predefined_acl = None ,
2706
2638
if_generation_match = None ,
@@ -2757,15 +2689,6 @@ def upload_from_file(
2757
2689
:type content_type: str
2758
2690
:param content_type: (Optional) Type of content being uploaded.
2759
2691
2760
- :type num_retries: int
2761
- :param num_retries:
2762
- Number of upload retries. By default, only uploads with
2763
- if_generation_match set will be retried, as uploads without the
2764
- argument are not guaranteed to be idempotent. Setting num_retries
2765
- will override this default behavior and guarantee retries even when
2766
- if_generation_match is not set. (Deprecated: This argument
2767
- will be removed in a future release.)
2768
-
2769
2692
:type client: :class:`~google.cloud.storage.client.Client`
2770
2693
:param client:
2771
2694
(Optional) The client to use. If not passed, falls back to the
@@ -2829,7 +2752,6 @@ def upload_from_file(
2829
2752
rewind = rewind ,
2830
2753
size = size ,
2831
2754
content_type = content_type ,
2832
- num_retries = num_retries ,
2833
2755
client = client ,
2834
2756
predefined_acl = predefined_acl ,
2835
2757
if_generation_match = if_generation_match ,
@@ -2869,7 +2791,6 @@ def upload_from_filename(
2869
2791
self ,
2870
2792
filename ,
2871
2793
content_type = None ,
2872
- num_retries = None ,
2873
2794
client = None ,
2874
2795
predefined_acl = None ,
2875
2796
if_generation_match = None ,
@@ -2918,15 +2839,6 @@ def upload_from_filename(
2918
2839
(Optional) The client to use. If not passed, falls back to the
2919
2840
``client`` stored on the blob's bucket.
2920
2841
2921
- :type num_retries: int
2922
- :param num_retries:
2923
- Number of upload retries. By default, only uploads with
2924
- if_generation_match set will be retried, as uploads without the
2925
- argument are not guaranteed to be idempotent. Setting num_retries
2926
- will override this default behavior and guarantee retries even when
2927
- if_generation_match is not set. (Deprecated: This argument
2928
- will be removed in a future release.)
2929
-
2930
2842
:type predefined_acl: str
2931
2843
:param predefined_acl: (Optional) Predefined access control list
2932
2844
@@ -2981,7 +2893,6 @@ def upload_from_filename(
2981
2893
self ._handle_filename_and_upload (
2982
2894
filename ,
2983
2895
content_type = content_type ,
2984
- num_retries = num_retries ,
2985
2896
client = client ,
2986
2897
predefined_acl = predefined_acl ,
2987
2898
if_generation_match = if_generation_match ,
@@ -2997,7 +2908,6 @@ def upload_from_string(
2997
2908
self ,
2998
2909
data ,
2999
2910
content_type = "text/plain" ,
3000
- num_retries = None ,
3001
2911
client = None ,
3002
2912
predefined_acl = None ,
3003
2913
if_generation_match = None ,
@@ -3033,15 +2943,6 @@ def upload_from_string(
3033
2943
(Optional) Type of content being uploaded. Defaults to
3034
2944
``'text/plain'``.
3035
2945
3036
- :type num_retries: int
3037
- :param num_retries:
3038
- Number of upload retries. By default, only uploads with
3039
- if_generation_match set will be retried, as uploads without the
3040
- argument are not guaranteed to be idempotent. Setting num_retries
3041
- will override this default behavior and guarantee retries even when
3042
- if_generation_match is not set. (Deprecated: This argument
3043
- will be removed in a future release.)
3044
-
3045
2946
:type client: :class:`~google.cloud.storage.client.Client`
3046
2947
:param client:
3047
2948
(Optional) The client to use. If not passed, falls back to the
@@ -3103,7 +3004,6 @@ def upload_from_string(
3103
3004
file_obj = string_buffer ,
3104
3005
size = len (data ),
3105
3006
content_type = content_type ,
3106
- num_retries = num_retries ,
3107
3007
client = client ,
3108
3008
predefined_acl = predefined_acl ,
3109
3009
if_generation_match = if_generation_match ,
@@ -3271,7 +3171,6 @@ def create_resumable_upload_session(
3271
3171
fake_stream ,
3272
3172
content_type ,
3273
3173
size ,
3274
- None ,
3275
3174
predefined_acl = predefined_acl ,
3276
3175
if_generation_match = if_generation_match ,
3277
3176
if_generation_not_match = if_generation_not_match ,
@@ -4061,16 +3960,9 @@ def open(
4061
3960
For uploads only, the following additional arguments are supported:
4062
3961
4063
3962
- ``content_type``
4064
- - ``num_retries``
7968
span>
4065
3963
- ``predefined_acl``
4066
3964
- ``checksum``
4067
3965
4068
- .. note::
4069
-
4070
- ``num_retries`` is supported for backwards-compatibility
4071
- reasons only; please use ``retry`` with a Retry object or
4072
- ConditionalRetryPolicy instead.
4073
-
4074
3966
:type mode: str
4075
3967
:param mode:
4076
3968
(Optional) A mode string, as per standard Python `open()` semantics.The first
0 commit comments