google-cloud-storage 2.18.2__tar.gz → 3.0.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (108) hide show
  1. {google_cloud_storage-2.18.2/google_cloud_storage.egg-info → google_cloud_storage-3.0.0}/PKG-INFO +71 -1
  2. {google_cloud_storage-2.18.2 → google_cloud_storage-3.0.0}/README.rst +70 -0
  3. {google_cloud_storage-2.18.2 → google_cloud_storage-3.0.0}/google/cloud/storage/_helpers.py +4 -42
  4. google_cloud_storage-3.0.0/google/cloud/storage/_media/__init__.py +34 -0
  5. google_cloud_storage-3.0.0/google/cloud/storage/_media/_download.py +620 -0
  6. google_cloud_storage-3.0.0/google/cloud/storage/_media/_helpers.py +383 -0
  7. google_cloud_storage-3.0.0/google/cloud/storage/_media/_upload.py +1602 -0
  8. google_cloud_storage-3.0.0/google/cloud/storage/_media/common.py +21 -0
  9. google_cloud_storage-3.0.0/google/cloud/storage/_media/py.typed +2 -0
  10. google_cloud_storage-3.0.0/google/cloud/storage/_media/requests/__init__.py +685 -0
  11. google_cloud_storage-3.0.0/google/cloud/storage/_media/requests/_request_helpers.py +107 -0
  12. google_cloud_storage-3.0.0/google/cloud/storage/_media/requests/download.py +707 -0
  13. google_cloud_storage-3.0.0/google/cloud/storage/_media/requests/upload.py +771 -0
  14. {google_cloud_storage-2.18.2 → google_cloud_storage-3.0.0}/google/cloud/storage/_opentelemetry_tracing.py +7 -0
  15. {google_cloud_storage-2.18.2 → google_cloud_storage-3.0.0}/google/cloud/storage/_signing.py +26 -8
  16. {google_cloud_storage-2.18.2 → google_cloud_storage-3.0.0}/google/cloud/storage/acl.py +182 -0
  17. {google_cloud_storage-2.18.2 → google_cloud_storage-3.0.0}/google/cloud/storage/blob.py +213 -293
  18. {google_cloud_storage-2.18.2 → google_cloud_storage-3.0.0}/google/cloud/storage/bucket.py +128 -23
  19. {google_cloud_storage-2.18.2 → google_cloud_storage-3.0.0}/google/cloud/storage/client.py +133 -20
  20. google_cloud_storage-3.0.0/google/cloud/storage/exceptions.py +69 -0
  21. {google_cloud_storage-2.18.2 → google_cloud_storage-3.0.0}/google/cloud/storage/fileio.py +24 -29
  22. {google_cloud_storage-2.18.2 → google_cloud_storage-3.0.0}/google/cloud/storage/retry.py +22 -3
  23. {google_cloud_storage-2.18.2 → google_cloud_storage-3.0.0}/google/cloud/storage/transfer_manager.py +20 -18
  24. {google_cloud_storage-2.18.2 → google_cloud_storage-3.0.0}/google/cloud/storage/version.py +1 -1
  25. {google_cloud_storage-2.18.2 → google_cloud_storage-3.0.0/google_cloud_storage.egg-info}/PKG-INFO +71 -1
  26. {google_cloud_storage-2.18.2 → google_cloud_storage-3.0.0}/google_cloud_storage.egg-info/SOURCES.txt +36 -0
  27. {google_cloud_storage-2.18.2 → google_cloud_storage-3.0.0}/setup.py +7 -0
  28. {google_cloud_storage-2.18.2 → google_cloud_storage-3.0.0}/tests/conformance/retry_strategy_test_data.json +3 -4
  29. {google_cloud_storage-2.18.2 → google_cloud_storage-3.0.0}/tests/conformance/test_conformance.py +5 -6
  30. google_cloud_storage-3.0.0/tests/resumable_media/__init__.py +13 -0
  31. google_cloud_storage-3.0.0/tests/resumable_media/data/brotli.txt +64 -0
  32. google_cloud_storage-3.0.0/tests/resumable_media/data/brotli.txt.br +0 -0
  33. google_cloud_storage-3.0.0/tests/resumable_media/data/favicon.ico +0 -0
  34. google_cloud_storage-3.0.0/tests/resumable_media/data/file.txt +64 -0
  35. google_cloud_storage-3.0.0/tests/resumable_media/data/gzipped.txt +64 -0
  36. google_cloud_storage-3.0.0/tests/resumable_media/data/gzipped.txt.gz +0 -0
  37. google_cloud_storage-3.0.0/tests/resumable_media/data/image1.jpg +0 -0
  38. google_cloud_storage-3.0.0/tests/resumable_media/data/image2.jpg +0 -0
  39. google_cloud_storage-3.0.0/tests/resumable_media/system/__init__.py +13 -0
  40. google_cloud_storage-3.0.0/tests/resumable_media/system/credentials.json.enc +52 -0
  41. google_cloud_storage-3.0.0/tests/resumable_media/system/requests/__init__.py +13 -0
  42. google_cloud_storage-3.0.0/tests/resumable_media/system/requests/conftest.py +58 -0
  43. google_cloud_storage-3.0.0/tests/resumable_media/system/requests/test_download.py +637 -0
  44. google_cloud_storage-3.0.0/tests/resumable_media/system/requests/test_upload.py +777 -0
  45. google_cloud_storage-3.0.0/tests/resumable_media/system/utils.py +88 -0
  46. google_cloud_storage-3.0.0/tests/resumable_media/unit/__init__.py +13 -0
  47. google_cloud_storage-3.0.0/tests/resumable_media/unit/requests/__init__.py +13 -0
  48. google_cloud_storage-3.0.0/tests/resumable_media/unit/requests/test__helpers.py +59 -0
  49. google_cloud_storage-3.0.0/tests/resumable_media/unit/requests/test_download.py +1303 -0
  50. google_cloud_storage-3.0.0/tests/resumable_media/unit/requests/test_upload.py +412 -0
  51. google_cloud_storage-3.0.0/tests/resumable_media/unit/test__download.py +751 -0
  52. google_cloud_storage-3.0.0/tests/resumable_media/unit/test__helpers.py +421 -0
  53. google_cloud_storage-3.0.0/tests/resumable_media/unit/test__upload.py +1576 -0
  54. {google_cloud_storage-2.18.2 → google_cloud_storage-3.0.0}/tests/system/_helpers.py +4 -0
  55. {google_cloud_storage-2.18.2 → google_cloud_storage-3.0.0}/tests/system/conftest.py +83 -0
  56. {google_cloud_storage-2.18.2 → google_cloud_storage-3.0.0}/tests/system/test__signing.py +82 -0
  57. {google_cloud_storage-2.18.2 → google_cloud_storage-3.0.0}/tests/system/test_blob.py +6 -6
  58. {google_cloud_storage-2.18.2 → google_cloud_storage-3.0.0}/tests/system/test_client.py +75 -0
  59. {google_cloud_storage-2.18.2 → google_cloud_storage-3.0.0}/tests/system/test_fileio.py +63 -0
  60. {google_cloud_storage-2.18.2 → google_cloud_storage-3.0.0}/tests/unit/test__helpers.py +2 -41
  61. {google_cloud_storage-2.18.2 → google_cloud_storage-3.0.0}/tests/unit/test__opentelemetry_tracing.py +9 -14
  62. {google_cloud_storage-2.18.2 → google_cloud_storage-3.0.0}/tests/unit/test_acl.py +53 -0
  63. {google_cloud_storage-2.18.2 → google_cloud_storage-3.0.0}/tests/unit/test_blob.py +204 -226
  64. {google_cloud_storage-2.18.2 → google_cloud_storage-3.0.0}/tests/unit/test_bucket.py +101 -20
  65. {google_cloud_storage-2.18.2 → google_cloud_storage-3.0.0}/tests/unit/test_client.py +164 -7
  66. google_cloud_storage-3.0.0/tests/unit/test_exceptions.py +82 -0
  67. {google_cloud_storage-2.18.2 → google_cloud_storage-3.0.0}/tests/unit/test_fileio.py +76 -123
  68. {google_cloud_storage-2.18.2 → google_cloud_storage-3.0.0}/tests/unit/test_retry.py +19 -1
  69. {google_cloud_storage-2.18.2 → google_cloud_storage-3.0.0}/tests/unit/test_transfer_manager.py +5 -21
  70. {google_cloud_storage-2.18.2 → google_cloud_storage-3.0.0}/LICENSE +0 -0
  71. {google_cloud_storage-2.18.2 → google_cloud_storage-3.0.0}/MANIFEST.in +0 -0
  72. {google_cloud_storage-2.18.2 → google_cloud_storage-3.0.0}/google/cloud/storage/__init__.py +0 -0
  73. {google_cloud_storage-2.18.2 → google_cloud_storage-3.0.0}/google/cloud/storage/_http.py +0 -0
  74. {google_cloud_storage-2.18.2 → google_cloud_storage-3.0.0}/google/cloud/storage/batch.py +0 -0
  75. {google_cloud_storage-2.18.2 → google_cloud_storage-3.0.0}/google/cloud/storage/constants.py +0 -0
  76. {google_cloud_storage-2.18.2 → google_cloud_storage-3.0.0}/google/cloud/storage/hmac_key.py +0 -0
  77. {google_cloud_storage-2.18.2 → google_cloud_storage-3.0.0}/google/cloud/storage/iam.py +0 -0
  78. {google_cloud_storage-2.18.2 → google_cloud_storage-3.0.0}/google/cloud/storage/notification.py +0 -0
  79. {google_cloud_storage-2.18.2 → google_cloud_storage-3.0.0}/google_cloud_storage.egg-info/dependency_links.txt +0 -0
  80. {google_cloud_storage-2.18.2 → google_cloud_storage-3.0.0}/google_cloud_storage.egg-info/not-zip-safe +0 -0
  81. {google_cloud_storage-2.18.2 → google_cloud_storage-3.0.0}/google_cloud_storage.egg-info/requires.txt +0 -0
  82. {google_cloud_storage-2.18.2 → google_cloud_storage-3.0.0}/google_cloud_storage.egg-info/top_level.txt +0 -0
  83. {google_cloud_storage-2.18.2 → google_cloud_storage-3.0.0}/setup.cfg +0 -0
  84. {google_cloud_storage-2.18.2 → google_cloud_storage-3.0.0}/tests/__init__.py +0 -0
  85. {google_cloud_storage-2.18.2 → google_cloud_storage-3.0.0}/tests/conformance/README.md +0 -0
  86. {google_cloud_storage-2.18.2 → google_cloud_storage-3.0.0}/tests/conformance/__init__.py +0 -0
  87. {google_cloud_storage-2.18.2 → google_cloud_storage-3.0.0}/tests/conformance/conftest.py +0 -0
  88. {google_cloud_storage-2.18.2 → google_cloud_storage-3.0.0}/tests/data/CloudPlatform_128px_Retina.png +0 -0
  89. {google_cloud_storage-2.18.2 → google_cloud_storage-3.0.0}/tests/data/five-point-one-mb-file.zip +0 -0
  90. {google_cloud_storage-2.18.2 → google_cloud_storage-3.0.0}/tests/data/simple.txt +0 -0
  91. {google_cloud_storage-2.18.2 → google_cloud_storage-3.0.0}/tests/perf/README.md +0 -0
  92. {google_cloud_storage-2.18.2 → google_cloud_storage-3.0.0}/tests/perf/_perf_utils.py +0 -0
  93. {google_cloud_storage-2.18.2 → google_cloud_storage-3.0.0}/tests/perf/benchmarking.py +0 -0
  94. {google_cloud_storage-2.18.2 → google_cloud_storage-3.0.0}/tests/perf/profile_w1r3.py +0 -0
  95. {google_cloud_storage-2.18.2 → google_cloud_storage-3.0.0}/tests/system/__init__.py +0 -0
  96. {google_cloud_storage-2.18.2 → google_cloud_storage-3.0.0}/tests/system/test_bucket.py +0 -0
  97. {google_cloud_storage-2.18.2 → google_cloud_storage-3.0.0}/tests/system/test_hmac_key_metadata.py +0 -0
  98. {google_cloud_storage-2.18.2 → google_cloud_storage-3.0.0}/tests/system/test_kms_integration.py +0 -0
  99. {google_cloud_storage-2.18.2 → google_cloud_storage-3.0.0}/tests/system/test_notification.py +0 -0
  100. {google_cloud_storage-2.18.2 → google_cloud_storage-3.0.0}/tests/system/test_transfer_manager.py +0 -0
  101. {google_cloud_storage-2.18.2 → google_cloud_storage-3.0.0}/tests/unit/__init__.py +0 -0
  102. {google_cloud_storage-2.18.2 → google_cloud_storage-3.0.0}/tests/unit/test__http.py +0 -0
  103. {google_cloud_storage-2.18.2 → google_cloud_storage-3.0.0}/tests/unit/test__signing.py +0 -0
  104. {google_cloud_storage-2.18.2 → google_cloud_storage-3.0.0}/tests/unit/test_batch.py +0 -0
  105. {google_cloud_storage-2.18.2 → google_cloud_storage-3.0.0}/tests/unit/test_hmac_key.py +0 -0
  106. {google_cloud_storage-2.18.2 → google_cloud_storage-3.0.0}/tests/unit/test_notification.py +0 -0
  107. {google_cloud_storage-2.18.2 → google_cloud_storage-3.0.0}/tests/unit/url_signer_v4_test_account.json +0 -0
  108. {google_cloud_storage-2.18.2 → google_cloud_storage-3.0.0}/tests/unit/url_signer_v4_test_data.json +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: google-cloud-storage
3
- Version: 2.18.2
3
+ Version: 3.0.0
4
4
  Summary: Google Cloud Storage API client library
5
5
  Home-page: https://github.com/googleapis/python-storage
6
6
  Author: Google LLC
@@ -72,6 +72,76 @@ Google APIs Client Libraries, in `Client Libraries Explained`_.
72
72
  .. _Storage Control API: https://cloud.google.com/storage/docs/reference/rpc/google.storage.control.v2
73
73
  .. _Client Libraries Explained: https://cloud.google.com/apis/docs/client-libraries-explained
74
74
 
75
+ 3.0 Major Version Notes
76
+ -----------------------
77
+
78
+ Feedback Welcome
79
+ ~~~~~~~~~~~~~~~~
80
+
81
+ If you experience that backwards compatibility for your application is broken
82
+ with this major version release, please let us know through the Github issues
83
+ system. While some breaks of backwards compatibility may be unavoidable due to
84
+ new features in the major version release, we will do our best to minimize
85
+ them. Thank you.
86
+
87
+ Exception Handling
88
+ ~~~~~~~~~~~~~~~~~~
89
+
90
+ In Python Storage 3.0, the dependency ``google-resumable-media`` was integrated.
91
+ The ``google-resumable-media`` dependency included exceptions
92
+ ``google.resumable_media.common.InvalidResponse`` and
93
+ ``google.resumable_media.common.DataCorruption``, which were often imported
94
+ directly in user application code. The replacements for these exceptions are
95
+ ``google.cloud.storage.exceptions.InvalidResponse`` and
96
+ ``google.cloud.storage.exceptions.DataCorruption``. Please update application code
97
+ to import and use these exceptions instead.
98
+
99
+ For backwards compatibility, if ``google-resumable-media`` is installed, the new
100
+ exceptions will be defined as subclasses of the old exceptions, so applications
101
+ should continue to work without modification. This backwards compatibility
102
+ feature may be removed in a future major version update.
103
+
104
+ Some users may be using the original exception classes from the
105
+ ``google-resumable-media`` library without explicitly installing that library. So
106
+ as not to break user applications following this pattern,
107
+ ``google-resumable-media`` is still in the list of dependencies in this package's
108
+ setup.py file. Applications which do not import directly from
109
+ ``google-resumable-media`` can safely disregard this dependency.
110
+ This backwards compatibility feature **will be removed** in a future major
111
+ version update. Please migrate to using the ``google.cloud.storage.exceptions``
112
+ classes as above.
113
+
114
+ Checksum Defaults
115
+ ~~~~~~~~~~~~~~~~~
116
+
117
+ In Python Storage 3.0, uploads and downloads now have a default of "auto" where
118
+ applicable. "Auto" will use crc32c checksums, except for unusual cases where the
119
+ fast (C extension) crc32c implementation is not available, in which case it will
120
+ use md5 instead. Before Python Storage 3.0, the default was md5 for most
121
+ downloads and None for most uploads. Note that ranged downloads ("start" or
122
+ "end" set) still do not support any checksumming, and some features in
123
+ ``transfer_manager.py`` still support crc32c only.
124
+
125
+ Note: The method ``Blob.upload_from_file()`` requires a file in bytes mode, but
126
+ when checksum is set to None, as was the previous default, would not throw an
127
+ error if passed a file in string mode under some circumstances. With the new
128
+ defaults, it will now raise a TypeError. Please use a file opened in bytes
129
+ reading mode as required.
130
+
131
+ Miscellaneous
132
+ ~~~~~~~~~~~~~
133
+
134
+ - The ``BlobWriter`` class now attempts to terminate an ongoing resumable upload if
135
+ the writer exits with an exception.
136
+ - Retry behavior is now identical between media operations (uploads and
137
+ downloads) and other operations, and custom predicates are now supported for
138
+ media operations as well.
139
+ - ``Blob.download_as_filename()`` will now delete the empty file if it results in a
140
+ google.cloud.exceptions.NotFound exception (HTTP 404).
141
+ - Previously, object upload, metadata update, and delete methods had retries
142
+ disabled by default unless the generation or metageneration was specified in
143
+ the request. This has now changed so that retries are enabled by default.
144
+
75
145
  Quick Start
76
146
  -----------
77
147
 
@@ -37,6 +37,76 @@ Google APIs Client Libraries, in `Client Libraries Explained`_.
37
37
  .. _Storage Control API: https://cloud.google.com/storage/docs/reference/rpc/google.storage.control.v2
38
38
  .. _Client Libraries Explained: https://cloud.google.com/apis/docs/client-libraries-explained
39
39
 
40
+ 3.0 Major Version Notes
41
+ -----------------------
42
+
43
+ Feedback Welcome
44
+ ~~~~~~~~~~~~~~~~
45
+
46
+ If you experience that backwards compatibility for your application is broken
47
+ with this major version release, please let us know through the Github issues
48
+ system. While some breaks of backwards compatibility may be unavoidable due to
49
+ new features in the major version release, we will do our best to minimize
50
+ them. Thank you.
51
+
52
+ Exception Handling
53
+ ~~~~~~~~~~~~~~~~~~
54
+
55
+ In Python Storage 3.0, the dependency ``google-resumable-media`` was integrated.
56
+ The ``google-resumable-media`` dependency included exceptions
57
+ ``google.resumable_media.common.InvalidResponse`` and
58
+ ``google.resumable_media.common.DataCorruption``, which were often imported
59
+ directly in user application code. The replacements for these exceptions are
60
+ ``google.cloud.storage.exceptions.InvalidResponse`` and
61
+ ``google.cloud.storage.exceptions.DataCorruption``. Please update application code
62
+ to import and use these exceptions instead.
63
+
64
+ For backwards compatibility, if ``google-resumable-media`` is installed, the new
65
+ exceptions will be defined as subclasses of the old exceptions, so applications
66
+ should continue to work without modification. This backwards compatibility
67
+ feature may be removed in a future major version update.
68
+
69
+ Some users may be using the original exception classes from the
70
+ ``google-resumable-media`` library without explicitly installing that library. So
71
+ as not to break user applications following this pattern,
72
+ ``google-resumable-media`` is still in the list of dependencies in this package's
73
+ setup.py file. Applications which do not import directly from
74
+ ``google-resumable-media`` can safely disregard this dependency.
75
+ This backwards compatibility feature **will be removed** in a future major
76
+ version update. Please migrate to using the ``google.cloud.storage.exceptions``
77
+ classes as above.
78
+
79
+ Checksum Defaults
80
+ ~~~~~~~~~~~~~~~~~
81
+
82
+ In Python Storage 3.0, uploads and downloads now have a default of "auto" where
83
+ applicable. "Auto" will use crc32c checksums, except for unusual cases where the
84
+ fast (C extension) crc32c implementation is not available, in which case it will
85
+ use md5 instead. Before Python Storage 3.0, the default was md5 for most
86
+ downloads and None for most uploads. Note that ranged downloads ("start" or
87
+ "end" set) still do not support any checksumming, and some features in
88
+ ``transfer_manager.py`` still support crc32c only.
89
+
90
+ Note: The method ``Blob.upload_from_file()`` requires a file in bytes mode, but
91
+ when checksum is set to None, as was the previous default, would not throw an
92
+ error if passed a file in string mode under some circumstances. With the new
93
+ defaults, it will now raise a TypeError. Please use a file opened in bytes
94
+ reading mode as required.
95
+
96
+ Miscellaneous
97
+ ~~~~~~~~~~~~~
98
+
99
+ - The ``BlobWriter`` class now attempts to terminate an ongoing resumable upload if
100
+ the writer exits with an exception.
101
+ - Retry behavior is now identical between media operations (uploads and
102
+ downloads) and other operations, and custom predicates are now supported for
103
+ media operations as well.
104
+ - ``Blob.download_as_filename()`` will now delete the empty file if it results in a
105
+ google.cloud.exceptions.NotFound exception (HTTP 404).
106
+ - Previously, object upload, metadata update, and delete methods had retries
107
+ disabled by default unless the generation or metageneration was specified in
108
+ the request. This has now changed so that retries are enabled by default.
109
+
40
110
  Quick Start
41
111
  -----------
42
112
 
@@ -25,7 +25,6 @@ from urllib.parse import urlsplit
25
25
  from urllib.parse import urlunsplit
26
26
  from uuid import uuid4
27
27
 
28
- from google import resumable_media
29
28
  from google.auth import environment_vars
30
29
  from google.cloud.storage.constants import _DEFAULT_TIMEOUT
31
30
  from google.cloud.storage.retry import DEFAULT_RETRY
@@ -72,12 +71,6 @@ _GENERATION_MATCH_PARAMETERS = (
72
71
  ("if_source_metageneration_not_match", "ifSourceMetagenerationNotMatch"),
73
72
  )
74
73
 
75
- _NUM_RETRIES_MESSAGE = (
76
- "`num_retries` has been deprecated and will be removed in a future "
77
- "release. Use the `retry` argument with a Retry or ConditionalRetryPolicy "
78
- "object, or None, instead."
79
- )
80
-
81
74
  # _NOW() returns the current local date and time.
82
75
  # It is preferred to use timezone-aware datetimes _NOW(_UTC),
83
76
  # which returns the current UTC date and time.
@@ -293,6 +286,9 @@ class _PropertyMixin(object):
293
286
  )
294
287
  if soft_deleted is not None:
295
288
  query_params["softDeleted"] = soft_deleted
289
+ # Soft delete reload requires a generation, even for targets
290
+ # that don't include them in default query params (buckets).
291
+ query_params["generation"] = self.generation
296
292
  headers = self._encryption_headers()
297
293
  _add_etag_match_headers(
298
294
  headers, if_etag_match=if_etag_match, if_etag_not_match=if_etag_not_match
@@ -343,7 +339,7 @@ class _PropertyMixin(object):
343
339
  if_metageneration_match=None,
344
340
  if_metageneration_not_match=None,
345
341
  timeout=_DEFAULT_TIMEOUT,
346
- retry=DEFAULT_RETRY_IF_METAGENERATION_SPECIFIED,
342
+ retry=DEFAULT_RETRY,
347
343
  override_unlocked_retention=False,
348
344
  ):
349
345
  """Sends all changed properties in a PATCH request.
@@ -631,40 +627,6 @@ def _bucket_bound_hostname_url(host, scheme=None):
631
627
  return f"{scheme}://{host}"
632
628
 
633
629
 
634
- def _api_core_retry_to_resumable_media_retry(retry, num_retries=None):
635
- """Convert google.api.core.Retry to google.resumable_media.RetryStrategy.
636
-
637
- Custom predicates are not translated.
638
-
639
- :type retry: google.api_core.Retry
640
- :param retry: (Optional) The google.api_core.Retry object to translate.
641
-
642
- :type num_retries: int
643
- :param num_retries: (Optional) The number of retries desired. This is
644
- supported for backwards compatibility and is mutually exclusive with
645
- `retry`.
646
-
647
- :rtype: google.resumable_media.RetryStrategy
648
- :returns: A RetryStrategy with all applicable attributes copied from input,
649
- or a RetryStrategy with max_retries set to 0 if None was input.
650
- """
651
-
652
- if retry is not None and num_retries is not None:
653
- raise ValueError("num_retries and retry arguments are mutually exclusive")
654
-
655
- elif retry is not None:
656
- return resumable_media.RetryStrategy(
657
- max_sleep=retry._maximum,
658
- max_cumulative_retry=retry._deadline,
659
- initial_delay=retry._initial,
660
- multiplier=retry._multiplier,
661
- )
662
- elif num_retries is not None:
663
- return resumable_media.RetryStrategy(max_retries=num_retries)
664
- else:
665
- return resumable_media.RetryStrategy(max_retries=0)
666
-
667
-
668
630
  def _get_invocation_id():
669
631
  return "gccl-invocation-id/" + str(uuid4())
670
632
 
@@ -0,0 +1,34 @@
1
+ # Copyright 2017 Google Inc.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ """Utilities for Google Media Downloads and Resumable Uploads.
16
+
17
+ ===========
18
+ Subpackages
19
+ ===========
20
+
21
+ Each subpackage is tailored to a specific transport library:
22
+
23
+ * the :mod:`~google.cloud.storage._media.requests` subpackage uses the ``requests``
24
+ transport library.
25
+
26
+ .. _requests: http://docs.python-requests.org/
27
+ """
28
+
29
+ from google.cloud.storage._media.common import UPLOAD_CHUNK_SIZE
30
+
31
+
32
+ __all__ = [
33
+ "UPLOAD_CHUNK_SIZE",
34
+ ]