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 ._opentelemetry_tracing import create_trace_span
@@ -1863,7 +1862,6 @@ def _do_multipart_upload(
1863
1862
stream ,
1864
1863
content_type ,
1865
1864
size ,
1866
- num_retries ,
1867
1865
predefined_acl ,
1868
1866
if_generation_match ,
1869
1867
if_generation_not_match ,
@@ -1900,15 +1898,6 @@ def _do_multipart_upload(
1900
1898
``stream``). If not provided, the upload will be concluded once
1901
1899
``stream`` is exhausted (or :data:`None`).
1902
1900
1903
- :type num_retries: int
1904
- :param num_retries:
1905
- Number of upload retries. By default, only uploads with
1906
- if_generation_match set will be retried, as uploads without the
1907
- argument are not guaranteed to be idempotent. Setting num_retries
1908
- will override this default behavior and guarantee retries even when
1909
- if_generation_match is not set. (Deprecated: This argument
1910
- will be removed in a future release.)
1911
-
1912
1901
:type predefined_acl: str
1913
1902
:param predefined_acl: (Optional) Predefined access control list
1914
1903
@@ -2023,9 +2012,7 @@ def _do_multipart_upload(
2023
2012
upload_url = _add_query_parameters (base_url , name_value_pairs )
2024
2013
upload = MultipartUpload (upload_url , headers = headers , checksum = checksum )
2025
2014
2026
- upload ._retry_strategy = _api_core_retry_to_resumable_media_retry (
2027
- retry , num_retries
2028
- )
2015
+ upload ._retry_strategy = _api_core_retry_to_resumable_media_retry (retry )
2029
2016
2030
2017
extra_attributes = {
2031
2018
"url.full" : upload_url ,
@@ -2050,7 +2037,6 @@ def _initiate_resumable_upload(
2050
2037
stream ,
2051
2038
content_type ,
2052
2039
size ,
2053
- num_retries ,
2054
2040
predefined_acl = None ,
2055
2041
extra_headers = None ,
2056
2042
chunk_size = None ,
@@ -2092,15 +2078,6 @@ def _initiate_resumable_upload(
2092
2078
:type predefined_acl: str
2093
2079
:param predefined_acl: (Optional) Predefined access control list
2094
2080
2095
- :type num_retries: int
2096
- :param num_retries:
2097
- Number of upload retries. By default, only uploads with
2098
- if_generation_match set will be retried, as uploads without the
2099
- argument are not guaranteed to be idempotent. Setting num_retries
2100
- will override this default behavior and guarantee retries even when
2101
- if_generation_match is not set. (Deprecated: This argument
2102
- will be removed in a future release.)
2103
-
2104
2081
:type extra_headers: dict
2105
2082
:param extra_headers:
2106
2083
(Optional) Extra headers to add to standard headers.
@@ -2230,9 +2207,7 @@ def _initiate_resumable_upload(
2230
2207
upload_url , chunk_size , headers = headers , checksum = checksum
2231
2208
)
2232
2209
2233
- upload ._retry_strategy = _api_core_retry_to_resumable_media_retry (
2234
- retry , num_retries
2235
- )
2210
+ upload ._retry_strategy = _api_core_retry_to_resumable_media_retry (retry )
2236
2211
2237
2212
upload .initiate (
2238
2213
transport ,
@@ -2252,7 +2227,6 @@ def _do_resumable_upload(
2252
2227
stream ,
2253
2228
content_type ,
2254
2229
size ,
2255
- num_retries ,
2256
2230
predefined_acl ,
2257
2231
if_generation_match ,
2258
2232
if_generation_not_match ,
@@ -2292,15 +2266,6 @@ def _do_resumable_upload(
2292
2266
``stream``). If not provided, the upload will be concluded once
2293
2267
``stream`` is exhausted (or :data:`None`).
2294
2268
2295
- :type num_retries: int
2296
- :param num_retries:
2297
- Number of upload retries. By default, only uploads with
2298
- if_generation_match set will be retried, as uploads without the
2299
- argument are not guaranteed to be idempotent. Setting num_retries
2300
- will override this default behavior and guarantee retries even when
2301
- if_generation_match is not set. (Deprecated: This argument
2302
- will be removed in a future release.)
2303
-
2304
2269
:type predefined_acl: str
2305
2270
:param predefined_acl: (Optional) Predefined access control list
2306
2271
@@ -2365,7 +2330,6 @@ def _do_resumable_upload(
2365
2330
stream ,
2366
2331
content_type ,
2367
2332
size ,
2368
- num_retries ,
2369
2333
predefined_acl = predefined_acl ,
2370
2334
if_generation_match = if_generation_match ,
2371
2335
if_generation_not_match = if_generation_not_match ,
@@ -2403,7 +2367,6 @@ def _do_upload(
2403
2367
stream ,
2404
2368
content_type ,
2405
2369
size ,
2406
- num_retries ,
2407
2370
predefined_acl ,
2408
2371
if_generation_match ,
2409
2372
if_generation_not_match ,
@@ -2444,15 +2407,6 @@ def _do_upload(
2444
2407
``stream``). If not provided, the upload will be concluded once
2445
2408
``stream`` is exhausted (or :data:`None`).
2446
2409
2447
- :type num_retries: int
2448
- :param num_retries:
2449
- Number of upload retries. By default, only uploads with
2450
- if_generation_match set will be retried, as uploads without the
2451
- argument are not guaranteed to be idempotent. Setting num_retries
2452
- will override this default behavior and guarantee retries even when
2453
- if_generation_match is not set. (Deprecated: This argument
2454
- will be removed in a future release.)
2455
-
2456
2410
:type predefined_acl: str
2457
2411
:param predefined_acl: (Optional) Predefined access control list
2458
2412
@@ -2542,7 +2496,6 @@ def _do_upload(
2542
2496
stream ,
2543
2497
content_type ,
2544
2498
size ,
2545
- num_retries ,
2546
2499
predefined_acl ,
2547
2500
if_generation_match ,
2548
2501
if_generation_not_match ,
@@ -2559,7 +2512,6 @@ def _do_upload(
2559
2512
stream ,
2560
2513
content_type ,
2561
2514
size ,
2562
- num_retries ,
2563
2515
predefined_acl ,
2564
2516
if_generation_match ,
2565
2517
if_generation_not_match ,
@@ -2579,7 +2531,6 @@ def _prep_and_do_upload(
2579
2531
rewind = False ,
2580
2532
size = None ,
2581
2533
content_type = None ,
2582
- num_retries = None ,
2583
2534
client = None ,
2584
2535
predefined_acl = None ,
2585
2536
if_generation_match = None ,
@@ -2637,15 +2588,6 @@ def _prep_and_do_upload(
2637
2588
:type content_type: str
2638
2589
:param content_type: (Optional) Type of content being uploaded.
2639
2590
2640
- :type num_retries: int
2641
- :param num_retries:
2642
- Number of upload retries. By default, only uploads with
2643
- if_generation_match set will be retried, as uploads without the
2644
- argument are not guaranteed to be idempotent. Setting num_retries
2645
- will override this default behavior and guarantee retries even when
2646
- if_generation_match is not set. (Deprecated: This argument
2647
- will be removed in a future release.)
2648
-
2649
2591
:type client: :class:`~google.cloud.storage.client.Client`
2650
2592
:param client:
2651
2593
(Optional) The client to use. If not passed, falls back to the
@@ -2719,14 +2661,6 @@ def _prep_and_do_upload(
2719
2661
:raises: :class:`~google.cloud.exceptions.GoogleCloudError`
2720
2662
if the upload response returns an error status.
2721
2663
"""
2722
- if num_retries is not None :
2723
- warnings .warn (_NUM_RETRIES_MESSAGE , DeprecationWarning , stacklevel = 2 )
2724
- # num_retries and retry are mutually exclusive. If num_retries is
2725
- # set and retry is exactly the default, then nullify retry for
2726
- # backwards compatibility.
2727
- if retry is DEFAULT_RETRY_IF_GENERATION_SPECIFIED :
2728
- retry = None
2729
-
2730
2664
_maybe_rewind (file_obj , rewind = rewind )
2731
2665
predefined_acl = ACL .validate_predefined (predefined_acl )
2732
2666
@@ -2736,7 +2670,6 @@ def _prep_and_do_upload(
2736
2670
file_obj ,
2737
2671
content_type ,
2738
2672
size ,
2739
- num_retries ,
2740
2673
predefined_acl ,
2741
2674
if_generation_match ,
2742
2675
if_generation_not_match ,
@@ -2758,7 +2691,6 @@ def upload_from_file(
2758
2691
rewind = False ,
2759
2692
size = None ,
2760
2693
content_type = None ,
2761
- num_retries = None ,
2762
2694
client = None ,
2763
2695
predefined_acl = None ,
2764
2696
if_generation_match = None ,
@@ -2815,15 +2747,6 @@ def upload_from_file(
2815
2747
:type content_type: str
2816
2748
:param content_type: (Optional) Type of content being uploaded.
2817
2749
2818
- :type num_retries: int
2819
- :param num_retries:
2820
- Number of upload retries. By default, only uploads with
2821
- if_generation_match set will be retried, as uploads without the
2822
- argument are not guaranteed to be idempotent. Setting num_retries
2823
- will override this default behavior and guarantee retries even when
2824
- if_generation_match is not set. (Deprecated: This argument
2825
- will be removed in a future release.)
2826
-
2827
2750
:type client: :class:`~google.cloud.storage.client.Client`
2828
2751
:param client:
2829
2752
(Optional) The client to use. If not passed, falls back to the
@@ -2887,7 +2810,6 @@ def upload_from_file(
2887
2810
rewind = rewind ,
2888
2811
size = size ,
2889
2812
content_type = content_type ,
2890
- num_retries = num_retries ,
2891
2813
client = client ,
2892
2814
predefined_acl = predefined_acl ,
2893
2815
if_generation_match = if_generation_match ,
@@ -2928,7 +2850,6 @@ def upload_from_filename(
2928
2850
self ,
2929
2851
filename ,
2930
2852
content_type = None ,
2931
- num_retries = None ,
2932
2853
client = None ,
2933
2854
predefined_acl = None ,
2934
2855
if_generation_match = None ,
@@ -2977,15 +2898,6 @@ def upload_from_filename(
2977
2898
(Optional) The client to use. If not passed, falls back to the
2978
2899
``client`` stored on the blob's bucket.
2979
2900
2980
- :type num_retries: int
2981
- :param num_retries:
2982
- Number of upload retries. By default, only uploads with
2983
- if_generation_match set will be retried, as uploads without the
2984
- argument are not guaranteed to be idempotent. Setting num_retries
2985
- will override this default behavior and guarantee retries even when
2986
- if_generation_match is not set. (Deprecated: This argument
2987
- will be removed in a future release.)
2988
-
2989
2901
:type predefined_acl: str
2990
2902
:param predefined_acl: (Optional) Predefined access control list
2991
2903
@@ -3040,7 +2952,6 @@ def upload_from_filename(
3040
2952
self ._handle_filename_and_upload (
3041
2953
filename ,
3042
2954
content_type = content_type ,
3043
- num_retries = num_retries ,
3044
2955
client = client ,
3045
2956
predefined_acl = predefined_acl ,
3046
2957
if_generation_match = if_generation_match ,
@@ -3057,7 +2968,6 @@ def upload_from_string(
3057
2968
self ,
3058
2969
data ,
3059
2970
content_type = "text/plain" ,
3060
- num_retries = None ,
3061
2971
client = None ,
3062
2972
predefined_acl = None ,
3063
2973
if_generation_match = None ,
@@ -3093,15 +3003,6 @@ def upload_from_string(
3093
3003
(Optional) Type of content being uploaded. Defaults to
3094
3004
``'text/plain'``.
3095
3005
3096
- :type num_retries: int
3097
- :param num_retries:
3098
- Number of upload retries. By default, only uploads with
3099
- if_generation_match set will be retried, as uploads without the
3100
- argument are not guaranteed to be idempotent. Setting num_retries
3101
- will override this default behavior and guarantee retries even when
3102
- if_generation_match is not set. (Deprecated: This argument
3103
- will be removed in a future release.)
3104
-
3105
3006
:type client: :class:`~google.cloud.storage.client.Client`
3106
3007
:param client:
3107
3008
(Optional) The client to use. If not passed, falls back to the
@@ -3163,7 +3064,6 @@ def upload_from_string(
3163
3064
file_obj = string_buffer ,
3164
3065
size = len (data ),
3165
3066
content_type = content_type ,
3166
- num_retries = num_retries ,
3167
3067
client = client ,
3168
3068
predefined_acl = predefined_acl ,
3169
3069
if_generation_match = if_generation_match ,
@@ -3332,7 +3232,6 @@ def create_resumable_upload_session(
3332
3232
fake_stream ,
3333
3233
content_type ,
3334
3234
size ,
3335
- None ,
3336
3235
predefined_acl = predefined_acl ,
3337
3236
if_generation_match = if_generation_match ,
3338
3237
if_generation_not_match = if_generation_not_match ,
@@ -4131,16 +4030,9 @@ def open(
4131
4030
For uploads only, the following additional arguments are supported:
4132
4031
4133
4032
- ``content_type``
4134
- - ``num_retries``
4135
4033
- ``predefined_acl``
4136
4034
- ``checksum``
4137
4035
4138
- .. note::
4139
-
4140
- ``num_retries`` is supported for backwards-compatibility
4141
- reasons only; please use ``retry`` with a Retry object or
4142
- ConditionalRetryPolicy instead.
4143
-
4144
4036
:type mode: str
4145
4037
:param mode:
4146
4038
(Optional) A mode string, as per standard Python `open()` semantics.The first
0 commit comments