From e2d0e64905fab77dbfe8443dabcd50606b641c4d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mat=C4=9Bj=20Cepl?= Date: Fri, 4 Nov 2022 18:56:32 +0100 Subject: [PATCH 1/3] Remove direct usage of six from project (#3478) --- boto3/compat.py | 19 ++++++------------- boto3/dynamodb/types.py | 7 ++++--- tests/functional/test_s3.py | 11 ++++++----- tests/integration/test_s3.py | 11 +++++------ tests/unit/docs/test_docstring.py | 30 +++++++++++++++--------------- tests/unit/s3/test_inject.py | 11 ++++++----- 6 files changed, 42 insertions(+), 47 deletions(-) diff --git a/boto3/compat.py b/boto3/compat.py index ae495cf7d2..4011393aca 100644 --- a/boto3/compat.py +++ b/boto3/compat.py @@ -16,22 +16,15 @@ import socket import warnings -from botocore.vendored import six from boto3.exceptions import PythonDeprecationWarning -if six.PY3: - # In python3, socket.error is OSError, which is too general - # for what we want (i.e FileNotFoundError is a subclass of OSError). - # In py3 all the socket related errors are in a newly created - # ConnectionError - SOCKET_ERROR = ConnectionError -else: - SOCKET_ERROR = socket.error +# In python3, socket.error is OSError, which is too general +# for what we want (i.e FileNotFoundError is a subclass of OSError). +# In py3 all the socket related errors are in a newly created +# ConnectionError +SOCKET_ERROR = ConnectionError -if six.PY3: - import collections.abc as collections_abc -else: - import collections as collections_abc +import collections.abc as collections_abc if sys.platform.startswith('win'): diff --git a/boto3/dynamodb/types.py b/boto3/dynamodb/types.py index f696a6d4cf..f358b12f55 100644 --- a/boto3/dynamodb/types.py +++ b/boto3/dynamodb/types.py @@ -10,7 +10,6 @@ # distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF # ANY KIND, either express or implied. See the License for the specific # language governing permissions and limitations under the License. -import collections.abc from decimal import ( Clamped, Context, @@ -21,6 +20,8 @@ Underflow, ) +from boto3.compat import collections_abc + STRING = 'S' NUMBER = 'N' BINARY = 'B' @@ -183,7 +184,7 @@ def _is_binary(self, value): return False def _is_set(self, value): - if isinstance(value, collections.abc.Set): + if isinstance(value, collections_abc.Set): return True return False @@ -194,7 +195,7 @@ def _is_type_set(self, value, type_validator): return False def _is_map(self, value): - if isinstance(value, collections.abc.Mapping): + if isinstance(value, collections_abc.Mapping): return True return False diff --git a/tests/functional/test_s3.py b/tests/functional/test_s3.py index 43c978a0ec..0abbc84409 100644 --- a/tests/functional/test_s3.py +++ b/tests/functional/test_s3.py @@ -10,10 +10,11 @@ # distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF # ANY KIND, either express or implied. See the License for the specific # language governing permissions and limitations under the License. +import io + import botocore import botocore.stub import pytest -from botocore.compat import six from botocore.config import Config from botocore.stub import Stubber @@ -244,7 +245,7 @@ def progress_callback(amount): class TestUploadFileobj(BaseTransferTest): def setUp(self): super().setUp() - self.contents = six.BytesIO(b'foo\n') + self.contents = io.BytesIO(b'foo\n') def stub_put_object(self): put_object_response = { @@ -330,7 +331,7 @@ def test_object_upload(self): def test_multipart_upload(self): chunksize = 8 * (1024**2) - contents = six.BytesIO(b'0' * (chunksize * 3)) + contents = io.BytesIO(b'0' * (chunksize * 3)) self.stub_multipart_upload(num_parts=3) transfer_config = TransferConfig( multipart_chunksize=chunksize, @@ -354,7 +355,7 @@ class TestDownloadFileobj(BaseTransferTest): def setUp(self): super().setUp() self.contents = b'foo' - self.fileobj = six.BytesIO() + self.fileobj = io.BytesIO() def stub_single_part_download(self): self.stub_head(content_length=len(self.contents)) @@ -400,7 +401,7 @@ def stub_get_object(self, full_contents, start_byte=0, end_byte=None): "ETag": self.etag, "ContentLength": len(contents), "ContentType": "binary/octet-stream", - "Body": six.BytesIO(contents), + "Body": io.BytesIO(contents), "ResponseMetadata": {"HTTPStatusCode": 200}, } ) diff --git a/tests/integration/test_s3.py b/tests/integration/test_s3.py index 5393bbc0f8..162eaee373 100644 --- a/tests/integration/test_s3.py +++ b/tests/integration/test_s3.py @@ -12,6 +12,7 @@ # language governing permissions and limitations under the License. import datetime import hashlib +import io import logging import math import os @@ -21,13 +22,11 @@ import threading from botocore.client import Config -from botocore.compat import six import boto3.s3.transfer import boto3.session from tests import unique_id, unittest -urlopen = six.moves.urllib.request.urlopen LOG = logging.getLogger('boto3.tests.integration') @@ -338,7 +337,7 @@ def test_copy(self): self.object_exists('bar') def test_upload_fileobj(self): - fileobj = six.BytesIO(b'foo') + fileobj = io.BytesIO(b'foo') self.client.upload_fileobj( Fileobj=fileobj, Bucket=self.bucket_name, Key='foo' ) @@ -356,7 +355,7 @@ def test_upload_fileobj_progress(self): multipart_threshold=chunksize, max_concurrency=1, ) - fileobj = six.BytesIO(b'0' * (chunksize * 3)) + fileobj = io.BytesIO(b'0' * (chunksize * 3)) def progress_callback(amount): self.progress += amount @@ -374,7 +373,7 @@ def progress_callback(amount): self.assertEqual(self.progress, chunksize * 3) def test_download_fileobj(self): - fileobj = six.BytesIO() + fileobj = io.BytesIO() self.client.put_object( Bucket=self.bucket_name, Key='foo', Body=b'beach' ) @@ -692,7 +691,7 @@ def test_transfer_methods_do_not_use_threads(self): self.addCleanup(self.delete_object, key) self.assertTrue(self.object_exists(key)) - fileobj = six.BytesIO() + fileobj = io.BytesIO() self.client.download_fileobj( Bucket=self.bucket_name, Key='foo', Fileobj=fileobj, Config=config ) diff --git a/tests/unit/docs/test_docstring.py b/tests/unit/docs/test_docstring.py index f67d3ff5b8..68fe9559f5 100644 --- a/tests/unit/docs/test_docstring.py +++ b/tests/unit/docs/test_docstring.py @@ -10,7 +10,7 @@ # distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF # ANY KIND, either express or implied. See the License for the specific # language governing permissions and limitations under the License. -from botocore.compat import six +import io from tests import mock from tests.unit.docs import BaseDocsTest @@ -18,7 +18,7 @@ class TestResourceDocstrings(BaseDocsTest): def test_action_help(self): - with mock.patch('sys.stdout', six.StringIO()) as mock_stdout: + with mock.patch('sys.stdout', io.StringIO()) as mock_stdout: help(self.resource.sample_operation) action_docstring = mock_stdout.getvalue() self.assert_contains_lines_in_order( @@ -51,7 +51,7 @@ def test_action_help(self): def test_load_help(self): sub_resource = self.resource.Sample('Id') - with mock.patch('sys.stdout', six.StringIO()) as mock_stdout: + with mock.patch('sys.stdout', io.StringIO()) as mock_stdout: help(sub_resource.load) load_docstring = mock_stdout.getvalue() self.assert_contains_lines_in_order( @@ -69,7 +69,7 @@ def test_load_help(self): ) def test_sub_resource_help(self): - with mock.patch('sys.stdout', six.StringIO()) as mock_stdout: + with mock.patch('sys.stdout', io.StringIO()) as mock_stdout: help(self.resource.Sample) sub_resource_docstring = mock_stdout.getvalue() self.assert_contains_lines_in_order( @@ -85,7 +85,7 @@ def test_sub_resource_help(self): ) def test_attribute_help(self): - with mock.patch('sys.stdout', six.StringIO()) as mock_stdout: + with mock.patch('sys.stdout', io.StringIO()) as mock_stdout: help(self.resource.Sample('id').__class__.foo) attribute_docstring = mock_stdout.getvalue() self.assert_contains_lines_in_order( @@ -93,7 +93,7 @@ def test_attribute_help(self): ) def test_identifier_help(self): - with mock.patch('sys.stdout', six.StringIO()) as mock_stdout: + with mock.patch('sys.stdout', io.StringIO()) as mock_stdout: help(self.resource.Sample('id').__class__.name) identifier_docstring = mock_stdout.getvalue() self.assert_contains_lines_in_order( @@ -106,7 +106,7 @@ def test_identifier_help(self): def test_reference_help(self): sample_resource = self.resource.Sample('id') - with mock.patch('sys.stdout', six.StringIO()) as mock_stdout: + with mock.patch('sys.stdout', io.StringIO()) as mock_stdout: help(sample_resource.__class__.related_sample) reference_docstring = mock_stdout.getvalue() self.assert_contains_lines_in_order( @@ -118,7 +118,7 @@ def test_reference_help(self): ) def test_collection_help(self): - with mock.patch('sys.stdout', six.StringIO()) as mock_stdout: + with mock.patch('sys.stdout', io.StringIO()) as mock_stdout: help(self.resource.__class__.samples) collection_method_docstring = mock_stdout.getvalue() self.assert_contains_lines_in_order( @@ -127,7 +127,7 @@ def test_collection_help(self): ) def test_collection_all_method_help(self): - with mock.patch('sys.stdout', six.StringIO()) as mock_stdout: + with mock.patch('sys.stdout', io.StringIO()) as mock_stdout: help(self.resource.samples.all) collection_method_docstring = mock_stdout.getvalue() self.assert_contains_lines_in_order( @@ -146,7 +146,7 @@ def test_collection_all_method_help(self): ) def test_collection_filter_method_help(self): - with mock.patch('sys.stdout', six.StringIO()) as mock_stdout: + with mock.patch('sys.stdout', io.StringIO()) as mock_stdout: help(self.resource.samples.filter) collection_method_docstring = mock_stdout.getvalue() self.assert_contains_lines_in_order( @@ -168,7 +168,7 @@ def test_collection_filter_method_help(self): ) def test_collection_limit_method_help(self): - with mock.patch('sys.stdout', six.StringIO()) as mock_stdout: + with mock.patch('sys.stdout', io.StringIO()) as mock_stdout: help(self.resource.samples.limit) collection_method_docstring = mock_stdout.getvalue() self.assert_contains_lines_in_order( @@ -190,7 +190,7 @@ def test_collection_limit_method_help(self): ) def test_collection_page_size_method_help(self): - with mock.patch('sys.stdout', six.StringIO()) as mock_stdout: + with mock.patch('sys.stdout', io.StringIO()) as mock_stdout: help(self.resource.samples.page_size) collection_method_docstring = mock_stdout.getvalue() self.assert_contains_lines_in_order( @@ -213,7 +213,7 @@ def test_collection_page_size_method_help(self): def test_collection_chaining_help(self): collection = self.resource.samples.all() - with mock.patch('sys.stdout', six.StringIO()) as mock_stdout: + with mock.patch('sys.stdout', io.StringIO()) as mock_stdout: help(collection.all) collection_method_docstring = mock_stdout.getvalue() self.assert_contains_lines_in_order( @@ -232,7 +232,7 @@ def test_collection_chaining_help(self): ) def test_batch_action_help(self): - with mock.patch('sys.stdout', six.StringIO()) as mock_stdout: + with mock.patch('sys.stdout', io.StringIO()) as mock_stdout: help(self.resource.samples.operate) batch_action_docstring = mock_stdout.getvalue() self.assert_contains_lines_in_order( @@ -264,7 +264,7 @@ def test_batch_action_help(self): ) def test_resource_waiter_help(self): - with mock.patch('sys.stdout', six.StringIO()) as mock_stdout: + with mock.patch('sys.stdout', io.StringIO()) as mock_stdout: help(self.resource.Sample('id').wait_until_complete) resource_waiter_docstring = mock_stdout.getvalue() self.assert_contains_lines_in_order( diff --git a/tests/unit/s3/test_inject.py b/tests/unit/s3/test_inject.py index b460306504..422db39d91 100644 --- a/tests/unit/s3/test_inject.py +++ b/tests/unit/s3/test_inject.py @@ -10,8 +10,9 @@ # distributed on an 'AS IS' BASIS, WITHOUT WARRANTIES OR CONDITIONS OF # ANY KIND, either express or implied. See the License for the specific # language governing permissions and limitations under the License. +import io + import pytest -from botocore.compat import six from botocore.exceptions import ClientError from boto3.s3 import inject @@ -158,7 +159,7 @@ def test_copy(self): ) def test_upload_fileobj(self): - fileobj = six.BytesIO(b'foo') + fileobj = io.BytesIO(b'foo') inject.bucket_upload_fileobj(self.bucket, Key='key', Fileobj=fileobj) self.bucket.meta.client.upload_fileobj.assert_called_with( Bucket=self.bucket.name, @@ -170,7 +171,7 @@ def test_upload_fileobj(self): ) def test_download_fileobj(self): - obj = six.BytesIO() + obj = io.BytesIO() inject.bucket_download_fileobj(self.bucket, Key='key', Fileobj=obj) self.bucket.meta.client.download_fileobj.assert_called_with( Bucket=self.bucket.name, @@ -222,7 +223,7 @@ def test_copy(self): ) def test_upload_fileobj(self): - fileobj = six.BytesIO(b'foo') + fileobj = io.BytesIO(b'foo') inject.object_upload_fileobj(self.obj, Fileobj=fileobj) self.obj.meta.client.upload_fileobj.assert_called_with( Bucket=self.obj.bucket_name, @@ -234,7 +235,7 @@ def test_upload_fileobj(self): ) def test_download_fileobj(self): - fileobj = six.BytesIO() + fileobj = io.BytesIO() inject.object_download_fileobj(self.obj, Fileobj=fileobj) self.obj.meta.client.download_fileobj.assert_called_with( Bucket=self.obj.bucket_name, From a606032a1dea27461a4a100ea93ab8aabdf8dc8d Mon Sep 17 00:00:00 2001 From: aws-sdk-python-automation Date: Fri, 4 Nov 2022 19:18:25 +0000 Subject: [PATCH 2/3] Add changelog entries from botocore --- .changes/next-release/api-change-ec2-87770.json | 5 +++++ .changes/next-release/api-change-emrcontainers-75344.json | 5 +++++ .changes/next-release/api-change-endpointrules-17023.json | 5 +++++ .changes/next-release/api-change-logs-64023.json | 5 +++++ 4 files changed, 20 insertions(+) create mode 100644 .changes/next-release/api-change-ec2-87770.json create mode 100644 .changes/next-release/api-change-emrcontainers-75344.json create mode 100644 .changes/next-release/api-change-endpointrules-17023.json create mode 100644 .changes/next-release/api-change-logs-64023.json diff --git a/.changes/next-release/api-change-ec2-87770.json b/.changes/next-release/api-change-ec2-87770.json new file mode 100644 index 0000000000..1c832cc96a --- /dev/null +++ b/.changes/next-release/api-change-ec2-87770.json @@ -0,0 +1,5 @@ +{ + "type": "api-change", + "category": "``ec2``", + "description": "[``botocore``] This release adds API support for the recipient of an AMI account share to remove shared AMI launch permissions." +} diff --git a/.changes/next-release/api-change-emrcontainers-75344.json b/.changes/next-release/api-change-emrcontainers-75344.json new file mode 100644 index 0000000000..f3cc2778da --- /dev/null +++ b/.changes/next-release/api-change-emrcontainers-75344.json @@ -0,0 +1,5 @@ +{ + "type": "api-change", + "category": "``emr-containers``", + "description": "[``botocore``] Adding support for Job templates. Job templates allow you to create and store templates to configure Spark applications parameters. This helps you ensure consistent settings across applications by reusing and enforcing configuration overrides in data pipelines." +} diff --git a/.changes/next-release/api-change-endpointrules-17023.json b/.changes/next-release/api-change-endpointrules-17023.json new file mode 100644 index 0000000000..11a6d922e0 --- /dev/null +++ b/.changes/next-release/api-change-endpointrules-17023.json @@ -0,0 +1,5 @@ +{ + "type": "api-change", + "category": "``endpoint-rules``", + "description": "[``botocore``] Update endpoint-rules client to latest version" +} diff --git a/.changes/next-release/api-change-logs-64023.json b/.changes/next-release/api-change-logs-64023.json new file mode 100644 index 0000000000..26cb6cd328 --- /dev/null +++ b/.changes/next-release/api-change-logs-64023.json @@ -0,0 +1,5 @@ +{ + "type": "api-change", + "category": "``logs``", + "description": "[``botocore``] Doc-only update for bug fixes and support of export to buckets encrypted with SSE-KMS" +} From 07e275877686830c8f40856bbd08810d043afeb1 Mon Sep 17 00:00:00 2001 From: aws-sdk-python-automation Date: Fri, 4 Nov 2022 19:18:46 +0000 Subject: [PATCH 3/3] Bumping version to 1.26.3 --- .changes/1.26.3.json | 22 +++++++++++++++++++ .../next-release/api-change-ec2-87770.json | 5 ----- .../api-change-emrcontainers-75344.json | 5 ----- .../api-change-endpointrules-17023.json | 5 ----- .../next-release/api-change-logs-64023.json | 5 ----- CHANGELOG.rst | 9 ++++++++ boto3/__init__.py | 2 +- setup.cfg | 2 +- setup.py | 2 +- 9 files changed, 34 insertions(+), 23 deletions(-) create mode 100644 .changes/1.26.3.json delete mode 100644 .changes/next-release/api-change-ec2-87770.json delete mode 100644 .changes/next-release/api-change-emrcontainers-75344.json delete mode 100644 .changes/next-release/api-change-endpointrules-17023.json delete mode 100644 .changes/next-release/api-change-logs-64023.json diff --git a/.changes/1.26.3.json b/.changes/1.26.3.json new file mode 100644 index 0000000000..597d2db4ff --- /dev/null +++ b/.changes/1.26.3.json @@ -0,0 +1,22 @@ +[ + { + "category": "``ec2``", + "description": "[``botocore``] This release adds API support for the recipient of an AMI account share to remove shared AMI launch permissions.", + "type": "api-change" + }, + { + "category": "``emr-containers``", + "description": "[``botocore``] Adding support for Job templates. Job templates allow you to create and store templates to configure Spark applications parameters. This helps you ensure consistent settings across applications by reusing and enforcing configuration overrides in data pipelines.", + "type": "api-change" + }, + { + "category": "``logs``", + "description": "[``botocore``] Doc-only update for bug fixes and support of export to buckets encrypted with SSE-KMS", + "type": "api-change" + }, + { + "category": "``endpoint-rules``", + "description": "[``botocore``] Update endpoint-rules client to latest version", + "type": "api-change" + } +] \ No newline at end of file diff --git a/.changes/next-release/api-change-ec2-87770.json b/.changes/next-release/api-change-ec2-87770.json deleted file mode 100644 index 1c832cc96a..0000000000 --- a/.changes/next-release/api-change-ec2-87770.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "type": "api-change", - "category": "``ec2``", - "description": "[``botocore``] This release adds API support for the recipient of an AMI account share to remove shared AMI launch permissions." -} diff --git a/.changes/next-release/api-change-emrcontainers-75344.json b/.changes/next-release/api-change-emrcontainers-75344.json deleted file mode 100644 index f3cc2778da..0000000000 --- a/.changes/next-release/api-change-emrcontainers-75344.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "type": "api-change", - "category": "``emr-containers``", - "description": "[``botocore``] Adding support for Job templates. Job templates allow you to create and store templates to configure Spark applications parameters. This helps you ensure consistent settings across applications by reusing and enforcing configuration overrides in data pipelines." -} diff --git a/.changes/next-release/api-change-endpointrules-17023.json b/.changes/next-release/api-change-endpointrules-17023.json deleted file mode 100644 index 11a6d922e0..0000000000 --- a/.changes/next-release/api-change-endpointrules-17023.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "type": "api-change", - "category": "``endpoint-rules``", - "description": "[``botocore``] Update endpoint-rules client to latest version" -} diff --git a/.changes/next-release/api-change-logs-64023.json b/.changes/next-release/api-change-logs-64023.json deleted file mode 100644 index 26cb6cd328..0000000000 --- a/.changes/next-release/api-change-logs-64023.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "type": "api-change", - "category": "``logs``", - "description": "[``botocore``] Doc-only update for bug fixes and support of export to buckets encrypted with SSE-KMS" -} diff --git a/CHANGELOG.rst b/CHANGELOG.rst index beed537c43..c1bb75ca9c 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -2,6 +2,15 @@ CHANGELOG ========= +1.26.3 +====== + +* api-change:``ec2``: [``botocore``] This release adds API support for the recipient of an AMI account share to remove shared AMI launch permissions. +* api-change:``emr-containers``: [``botocore``] Adding support for Job templates. Job templates allow you to create and store templates to configure Spark applications parameters. This helps you ensure consistent settings across applications by reusing and enforcing configuration overrides in data pipelines. +* api-change:``logs``: [``botocore``] Doc-only update for bug fixes and support of export to buckets encrypted with SSE-KMS +* api-change:``endpoint-rules``: [``botocore``] Update endpoint-rules client to latest version + + 1.26.2 ====== diff --git a/boto3/__init__.py b/boto3/__init__.py index dda3e11b64..8f76a03df6 100644 --- a/boto3/__init__.py +++ b/boto3/__init__.py @@ -17,7 +17,7 @@ from boto3.session import Session __author__ = 'Amazon Web Services' -__version__ = '1.26.2' +__version__ = '1.26.3' # The default Boto3 session; autoloaded when needed. diff --git a/setup.cfg b/setup.cfg index 946a2b88b1..74d29ef6db 100644 --- a/setup.cfg +++ b/setup.cfg @@ -3,7 +3,7 @@ universal = 0 [metadata] requires_dist = - botocore>=1.29.2,<1.30.0 + botocore>=1.29.3,<1.30.0 jmespath>=0.7.1,<2.0.0 s3transfer>=0.6.0,<0.7.0 diff --git a/setup.py b/setup.py index 8ada3c4d33..58440c802f 100644 --- a/setup.py +++ b/setup.py @@ -13,7 +13,7 @@ requires = [ - 'botocore>=1.29.2,<1.30.0', + 'botocore>=1.29.3,<1.30.0', 'jmespath>=0.7.1,<2.0.0', 's3transfer>=0.6.0,<0.7.0', ]