boto3 1.37.31__py3-none-any.whl → 1.37.33__py3-none-any.whl

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.
boto3/__init__.py CHANGED
@@ -17,7 +17,7 @@ from boto3.compat import _warn_deprecated_python
17
17
  from boto3.session import Session
18
18
 
19
19
  __author__ = 'Amazon Web Services'
20
- __version__ = '1.37.31'
20
+ __version__ = '1.37.33'
21
21
 
22
22
 
23
23
  # The default Boto3 session; autoloaded when needed.
boto3/compat.py CHANGED
@@ -24,6 +24,8 @@ from boto3.exceptions import PythonDeprecationWarning
24
24
  # ConnectionError
25
25
  SOCKET_ERROR = ConnectionError
26
26
 
27
+ _APPEND_MODE_CHAR = 'a'
28
+
27
29
  import collections.abc as collections_abc
28
30
 
29
31
 
@@ -80,3 +82,7 @@ def _warn_deprecated_python():
80
82
  "later. More information can be found here: {}"
81
83
  ).format(py_version[0], py_version[1], params['date'], params['blog_link'])
82
84
  warnings.warn(warning, PythonDeprecationWarning)
85
+
86
+
87
+ def is_append_mode(fileobj):
88
+ return hasattr(fileobj, 'mode') and _APPEND_MODE_CHAR in fileobj.mode
boto3/s3/inject.py CHANGED
@@ -11,11 +11,13 @@
11
11
  # ANY KIND, either express or implied. See the License for the specific
12
12
  # language governing permissions and limitations under the License.
13
13
  import copy as python_copy
14
+ import logging
14
15
  from functools import partial
15
16
 
16
17
  from botocore.exceptions import ClientError
17
18
 
18
19
  from boto3 import utils
20
+ from boto3.compat import is_append_mode
19
21
  from boto3.s3.transfer import (
20
22
  ProgressCallbackInvoker,
21
23
  S3Transfer,
@@ -47,6 +49,9 @@ except ImportError:
47
49
  pass
48
50
 
49
51
 
52
+ logger = logging.getLogger(__name__)
53
+
54
+
50
55
  def inject_s3_transfer_methods(class_attributes, **kwargs):
51
56
  utils.inject_attribute(class_attributes, 'upload_file', upload_file)
52
57
  utils.inject_attribute(class_attributes, 'download_file', download_file)
@@ -766,6 +771,27 @@ def object_upload_fileobj(
766
771
  )
767
772
 
768
773
 
774
+ def disable_threading_if_append_mode(config, fileobj):
775
+ """Set `TransferConfig.use_threads` to `False` if file-like
776
+ object is in append mode.
777
+
778
+ :type config: boto3.s3.transfer.TransferConfig
779
+ :param config: The transfer configuration to be used when performing the
780
+ download.
781
+
782
+ :type fileobj: A file-like object
783
+ :param fileobj: A file-like object to inspect for append mode.
784
+ """
785
+ if is_append_mode(fileobj):
786
+ config.use_threads = False
787
+ logger.warning(
788
+ 'A single thread will be used because the provided file object '
789
+ 'is in append mode. Writes may always be appended to the end of '
790
+ 'the file regardless of seek position, so a single thread must be '
791
+ 'used to ensure sequential writes.'
792
+ )
793
+
794
+
769
795
  @with_current_context(partial(register_feature_id, 'S3_TRANSFER'))
770
796
  def download_fileobj(
771
797
  self, Bucket, Key, Fileobj, ExtraArgs=None, Callback=None, Config=None
@@ -819,7 +845,10 @@ def download_fileobj(
819
845
  if config is None:
820
846
  config = TransferConfig()
821
847
 
822
- with create_transfer_manager(self, config) as manager:
848
+ new_config = python_copy.copy(config)
849
+ disable_threading_if_append_mode(new_config, Fileobj)
850
+
851
+ with create_transfer_manager(self, new_config) as manager:
823
852
  future = manager.download(
824
853
  bucket=Bucket,
825
854
  key=Key,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: boto3
3
- Version: 1.37.31
3
+ Version: 1.37.33
4
4
  Summary: The AWS SDK for Python
5
5
  Home-page: https://github.com/boto/boto3
6
6
  Author: Amazon Web Services
@@ -23,7 +23,7 @@ Classifier: Programming Language :: Python :: 3.13
23
23
  Requires-Python: >= 3.8
24
24
  License-File: LICENSE
25
25
  License-File: NOTICE
26
- Requires-Dist: botocore (<1.38.0,>=1.37.31)
26
+ Requires-Dist: botocore (<1.38.0,>=1.37.33)
27
27
  Requires-Dist: jmespath (<2.0.0,>=0.7.1)
28
28
  Requires-Dist: s3transfer (<0.12.0,>=0.11.0)
29
29
  Provides-Extra: crt
@@ -1,5 +1,5 @@
1
- boto3/__init__.py,sha256=11VhJTLWvNmWBFQSLMw1JXzcwgunhUjrHTxA4CwoM_A,3420
2
- boto3/compat.py,sha256=1T-LvBYqd0z-L9hI-soU7O7v-678tyWWR2pztF055u0,2887
1
+ boto3/__init__.py,sha256=ceyrRFNdTRwLcuID8AP07plhdrko47iOO8beJ44GG-0,3420
2
+ boto3/compat.py,sha256=UbjNXF52WEOSxl5yWUX35ZeBH4Rp6AdYR4dpvjRgpxg,3017
3
3
  boto3/crt.py,sha256=VFstUtHMZrZ6eHJJ-YdXb4vqfIOcHbv1l51fdeY5cS0,5407
4
4
  boto3/exceptions.py,sha256=i13QpGxoFizxAGCzA2qmF9ldbI5IfBpn37DH75ddRF8,4127
5
5
  boto3/session.py,sha256=mEk9ystkkF6UQYtGJQ9EJ5OL8PNbrbArVDYEnF1bX8w,21717
@@ -53,11 +53,11 @@ boto3/resources/params.py,sha256=i6KAjOzjzou7ouViYbRZCz0CwqB6fA_6gOJFDIruTV8,611
53
53
  boto3/resources/response.py,sha256=aIATkyer_rl5qsp-OFCxe36whvY4JzjgNc9qN-vYMxg,11638
54
54
  boto3/s3/__init__.py,sha256=GkSq-WxXWfVHu1SEcMrlJbzkfw9ACgF3UdCL6fPpTmY,562
55
55
  boto3/s3/constants.py,sha256=ZaYknNwqGwsJEGkL92GXaBs9kjfRbyCDFt89wei8t7E,690
56
- boto3/s3/inject.py,sha256=1q0KZrZL32bSVIVnHv1kGEEn2Wj2tLaMpL0bw9Mx7kg,29402
56
+ boto3/s3/inject.py,sha256=roCNwtKHbxSwV6pZuevUJAyL09UKdeK-nVBeLltR7i8,30401
57
57
  boto3/s3/transfer.py,sha256=_0Xxoycr7CiUbLtSoPeRP8cjK7yYHnmDIm59CQPYDAs,15935
58
- boto3-1.37.31.dist-info/LICENSE,sha256=DVQuDIgE45qn836wDaWnYhSdxoLXgpRRKH4RuTjpRZQ,10174
59
- boto3-1.37.31.dist-info/METADATA,sha256=U4fqyaa8CT2Py33Ff3nTefpohTXl6j2s6V7cJIW-zpQ,6654
60
- boto3-1.37.31.dist-info/NOTICE,sha256=BPseYUhKeBDxugm7QrwByljJrzOSfXxaIVVuTE0cf6Q,83
61
- boto3-1.37.31.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
62
- boto3-1.37.31.dist-info/top_level.txt,sha256=MP6_SI1GcPseXodd3Ykt5F_mCBsrUksiziLxjEZKGUU,6
63
- boto3-1.37.31.dist-info/RECORD,,
58
+ boto3-1.37.33.dist-info/LICENSE,sha256=DVQuDIgE45qn836wDaWnYhSdxoLXgpRRKH4RuTjpRZQ,10174
59
+ boto3-1.37.33.dist-info/METADATA,sha256=6sZWfwghiIa28Q_F7UoTnWKqqBpFJh4MbxfNbXUlZVk,6654
60
+ boto3-1.37.33.dist-info/NOTICE,sha256=BPseYUhKeBDxugm7QrwByljJrzOSfXxaIVVuTE0cf6Q,83
61
+ boto3-1.37.33.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
62
+ boto3-1.37.33.dist-info/top_level.txt,sha256=MP6_SI1GcPseXodd3Ykt5F_mCBsrUksiziLxjEZKGUU,6
63
+ boto3-1.37.33.dist-info/RECORD,,