From 974a8c3fc3e3caac89bfb9bde85fb544d57479b9 Mon Sep 17 00:00:00 2001 From: Alexandre Detiste Date: Sun, 9 Feb 2025 14:09:51 +0100 Subject: [PATCH 1/3] remove the very last reference to "six" --- awscli/compat.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/awscli/compat.py b/awscli/compat.py index 1881c0c7ebe2..36f408eca54f 100644 --- a/awscli/compat.py +++ b/awscli/compat.py @@ -22,12 +22,11 @@ import shlex import signal import urllib.parse as urlparse +from collections import OrderedDict from configparser import RawConfigParser from urllib.error import URLError from urllib.request import urlopen -from botocore.compat import six, OrderedDict - import sys import zipfile from functools import partial From bfa4e25f96932786449306a2c80bbea9b9968525 Mon Sep 17 00:00:00 2001 From: Alexandre Detiste Date: Sun, 9 Feb 2025 16:09:18 +0100 Subject: [PATCH 2/3] trim more usage of botocore.compat shim --- awscli/argprocess.py | 3 ++- awscli/bcdoc/restdoc.py | 2 +- awscli/clidriver.py | 3 ++- awscli/customizations/cloudformation/yamlhelper.py | 4 ++-- awscli/customizations/cloudsearch.py | 2 +- awscli/customizations/commands.py | 2 +- awscli/customizations/eks/kubeconfig.py | 2 +- awscli/customizations/eks/ordered_yaml.py | 3 ++- awscli/customizations/eks/update_kubeconfig.py | 3 +-- awscli/customizations/emr/createcluster.py | 3 ++- awscli/customizations/emr/emrfsutils.py | 3 ++- awscli/customizations/servicecatalog/generateproduct.py | 2 +- .../servicecatalog/generateprovisioningartifact.py | 2 +- awscli/formatter.py | 2 +- tests/functional/eks/test_kubeconfig.py | 3 +-- tests/unit/customizations/cloudformation/test_yamlhelper.py | 5 ++--- .../customizations/datapipeline/test_create_default_role.py | 3 ++- tests/unit/customizations/datapipeline/test_translator.py | 5 +++-- tests/unit/customizations/dlm/test_create_default_role.py | 3 ++- tests/unit/customizations/eks/test_kubeconfig.py | 2 +- tests/unit/customizations/eks/test_update_kubeconfig.py | 2 +- .../customizations/emr/test_create_cluster_release_label.py | 5 ++--- tests/unit/customizations/emr/test_create_default_role.py | 3 ++- .../customizations/servicecatalog/test_generateproduct.py | 2 +- .../servicecatalog/test_generateprovisioningartifact.py | 2 +- tests/unit/output/test_json_output.py | 4 ++-- tests/unit/test_argprocess.py | 2 +- tests/unit/test_clidriver.py | 2 +- tests/unit/test_completer.py | 2 +- tests/unit/test_schema.py | 3 +-- 30 files changed, 44 insertions(+), 40 deletions(-) diff --git a/awscli/argprocess.py b/awscli/argprocess.py index 14bc648e3edd..5b5f3ac2b677 100644 --- a/awscli/argprocess.py +++ b/awscli/argprocess.py @@ -12,10 +12,11 @@ # language governing permissions and limitations under the License. """Module for processing CLI args.""" +import json import logging import os +from collections import OrderedDict -from botocore.compat import OrderedDict, json from botocore.utils import is_json_value_header from awscli import COMPLEX_TYPES, SCALAR_TYPES, shorthand diff --git a/awscli/bcdoc/restdoc.py b/awscli/bcdoc/restdoc.py index d194d0e9f0ac..a1147c495586 100644 --- a/awscli/bcdoc/restdoc.py +++ b/awscli/bcdoc/restdoc.py @@ -11,8 +11,8 @@ # ANY KIND, either express or implied. See the License for the specific # language governing permissions and limitations under the License. import logging +from collections import OrderedDict -from botocore.compat import OrderedDict from awscli.bcdoc.docstringparser import DocStringParser from awscli.bcdoc.style import ReSTStyle diff --git a/awscli/clidriver.py b/awscli/clidriver.py index 37c7bc6322c6..449cdcefc743 100644 --- a/awscli/clidriver.py +++ b/awscli/clidriver.py @@ -13,9 +13,10 @@ import logging import signal import sys +from collections import OrderedDict import botocore.session -from botocore.compat import OrderedDict, copy_kwargs +from botocore.compat import copy_kwargs from botocore.exceptions import ( NoCredentialsError, NoRegionError, diff --git a/awscli/customizations/cloudformation/yamlhelper.py b/awscli/customizations/cloudformation/yamlhelper.py index 61603603e669..0b45a299be41 100644 --- a/awscli/customizations/cloudformation/yamlhelper.py +++ b/awscli/customizations/cloudformation/yamlhelper.py @@ -10,8 +10,8 @@ # 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 json -from botocore.compat import OrderedDict +import json +from collections import OrderedDict import yaml from yaml.resolver import ScalarNode, SequenceNode diff --git a/awscli/customizations/cloudsearch.py b/awscli/customizations/cloudsearch.py index f1311d723829..6a802cc83c6d 100644 --- a/awscli/customizations/cloudsearch.py +++ b/awscli/customizations/cloudsearch.py @@ -12,9 +12,9 @@ # language governing permissions and limitations under the License. import logging +from collections import OrderedDict from awscli.customizations.flatten import FlattenArguments, SEP -from botocore.compat import OrderedDict LOG = logging.getLogger(__name__) diff --git a/awscli/customizations/commands.py b/awscli/customizations/commands.py index 45ac54e565ff..b66ba02c1598 100644 --- a/awscli/customizations/commands.py +++ b/awscli/customizations/commands.py @@ -1,8 +1,8 @@ import logging import os +from collections import OrderedDict from botocore import model -from botocore.compat import OrderedDict from botocore.validate import validate_parameters import awscli diff --git a/awscli/customizations/eks/kubeconfig.py b/awscli/customizations/eks/kubeconfig.py index a680384a3153..52595ebef4bf 100644 --- a/awscli/customizations/eks/kubeconfig.py +++ b/awscli/customizations/eks/kubeconfig.py @@ -15,7 +15,7 @@ import yaml import logging import errno -from botocore.compat import OrderedDict +from collections import OrderedDict from awscli.customizations.eks.exceptions import EKSError from awscli.customizations.eks.ordered_yaml import (ordered_yaml_load, diff --git a/awscli/customizations/eks/ordered_yaml.py b/awscli/customizations/eks/ordered_yaml.py index aacac1fcf16f..4c75af535ebe 100644 --- a/awscli/customizations/eks/ordered_yaml.py +++ b/awscli/customizations/eks/ordered_yaml.py @@ -11,8 +11,9 @@ # ANY KIND, either express or implied. See the License for the specific # language governing permissions and limitations under the License. +from colelctions import OrderedDict + import yaml -from botocore.compat import OrderedDict class SafeOrderedLoader(yaml.SafeLoader): diff --git a/awscli/customizations/eks/update_kubeconfig.py b/awscli/customizations/eks/update_kubeconfig.py index 0e6971b85f2b..c585c5fe0c65 100644 --- a/awscli/customizations/eks/update_kubeconfig.py +++ b/awscli/customizations/eks/update_kubeconfig.py @@ -13,8 +13,7 @@ import os import logging - -from botocore.compat import OrderedDict +from collections import OrderedDict from awscli.customizations.commands import BasicCommand from awscli.customizations.utils import uni_print diff --git a/awscli/customizations/emr/createcluster.py b/awscli/customizations/emr/createcluster.py index 63ad398e1c15..94c0b9d831b7 100644 --- a/awscli/customizations/emr/createcluster.py +++ b/awscli/customizations/emr/createcluster.py @@ -11,7 +11,9 @@ # ANY KIND, either express or implied. See the License for the specific # language governing permissions and limitations under the License. +import json import re + from awscli.customizations.commands import BasicCommand from awscli.customizations.emr import applicationutils from awscli.customizations.emr import argumentschema @@ -27,7 +29,6 @@ from awscli.customizations.emr.command import Command from awscli.customizations.emr.constants import EC2_ROLE_NAME from awscli.customizations.emr.constants import EMR_ROLE_NAME -from botocore.compat import json class CreateCluster(Command): diff --git a/awscli/customizations/emr/emrfsutils.py b/awscli/customizations/emr/emrfsutils.py index ab6bdadc85d0..5c6b12609918 100644 --- a/awscli/customizations/emr/emrfsutils.py +++ b/awscli/customizations/emr/emrfsutils.py @@ -11,10 +11,11 @@ # ANY KIND, either express or implied. See the License for the specific # language governing permissions and limitations under the License. +from colelctions import OrderedDict + from awscli.customizations.emr import constants from awscli.customizations.emr import emrutils from awscli.customizations.emr import exceptions -from botocore.compat import OrderedDict CONSISTENT_OPTIONAL_KEYS = ['RetryCount', 'RetryPeriod'] diff --git a/awscli/customizations/servicecatalog/generateproduct.py b/awscli/customizations/servicecatalog/generateproduct.py index 2f3786563c83..3a557a1d1b91 100644 --- a/awscli/customizations/servicecatalog/generateproduct.py +++ b/awscli/customizations/servicecatalog/generateproduct.py @@ -11,12 +11,12 @@ # ANY KIND, either express or implied. See the License for the specific # language governing permissions and limitations under the License. +import json import sys from awscli.customizations.servicecatalog import helptext from awscli.customizations.servicecatalog.generatebase \ import GenerateBaseCommand -from botocore.compat import json class GenerateProductCommand(GenerateBaseCommand): diff --git a/awscli/customizations/servicecatalog/generateprovisioningartifact.py b/awscli/customizations/servicecatalog/generateprovisioningartifact.py index e79a378357a3..77da0bf8b48c 100644 --- a/awscli/customizations/servicecatalog/generateprovisioningartifact.py +++ b/awscli/customizations/servicecatalog/generateprovisioningartifact.py @@ -11,12 +11,12 @@ # ANY KIND, either express or implied. See the License for the specific # language governing permissions and limitations under the License. +import json import sys from awscli.customizations.servicecatalog import helptext from awscli.customizations.servicecatalog.generatebase \ import GenerateBaseCommand -from botocore.compat import json class GenerateProvisioningArtifactCommand(GenerateBaseCommand): diff --git a/awscli/formatter.py b/awscli/formatter.py index e13b6fd72c62..ee16cb3b02ab 100644 --- a/awscli/formatter.py +++ b/awscli/formatter.py @@ -10,9 +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 json import logging -from botocore.compat import json from botocore.paginate import PageIterator from botocore.utils import set_value_from_jmespath diff --git a/tests/functional/eks/test_kubeconfig.py b/tests/functional/eks/test_kubeconfig.py index 2eeb30b36e1c..b7de21e0a3f4 100644 --- a/tests/functional/eks/test_kubeconfig.py +++ b/tests/functional/eks/test_kubeconfig.py @@ -13,8 +13,7 @@ import os import shutil import tempfile - -from botocore.compat import OrderedDict +from collections import OrderedDict from awscli.testutils import mock, unittest from tests.functional.eks.test_util import get_testdata diff --git a/tests/unit/customizations/cloudformation/test_yamlhelper.py b/tests/unit/customizations/cloudformation/test_yamlhelper.py index 7a5d21bae00f..1d9d44cbd785 100644 --- a/tests/unit/customizations/cloudformation/test_yamlhelper.py +++ b/tests/unit/customizations/cloudformation/test_yamlhelper.py @@ -10,10 +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 json import tempfile - -from botocore.compat import json -from botocore.compat import OrderedDict +from collections import OrderedDict from awscli.testutils import mock, unittest from awscli.customizations.cloudformation.deployer import Deployer diff --git a/tests/unit/customizations/datapipeline/test_create_default_role.py b/tests/unit/customizations/datapipeline/test_create_default_role.py index 86dee1643c02..5773a9a3705d 100644 --- a/tests/unit/customizations/datapipeline/test_create_default_role.py +++ b/tests/unit/customizations/datapipeline/test_create_default_role.py @@ -1,3 +1,5 @@ +import json + import pytest import awscli.customizations.datapipeline.createdefaultroles \ @@ -11,7 +13,6 @@ from awscli.testutils import BaseAWSCommandParamsTest,\ mock, unittest from awscli.customizations.datapipeline.translator import dict_to_string -from botocore.compat import json @pytest.mark.filterwarnings('ignore::UserWarning') diff --git a/tests/unit/customizations/datapipeline/test_translator.py b/tests/unit/customizations/datapipeline/test_translator.py index 21871abe2ca9..da32bffc546f 100644 --- a/tests/unit/customizations/datapipeline/test_translator.py +++ b/tests/unit/customizations/datapipeline/test_translator.py @@ -10,12 +10,13 @@ # 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 json +from collections import OrderedDict + from awscli.customizations.datapipeline.translator \ import PipelineDefinitionError from awscli.testutils import unittest -from botocore.compat import OrderedDict, json - from awscli.customizations.datapipeline import translator diff --git a/tests/unit/customizations/dlm/test_create_default_role.py b/tests/unit/customizations/dlm/test_create_default_role.py index a9514189775f..269d747cad77 100644 --- a/tests/unit/customizations/dlm/test_create_default_role.py +++ b/tests/unit/customizations/dlm/test_create_default_role.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 json + from awscli.testutils import BaseAWSCommandParamsTest, mock, unittest -from botocore.compat import json import botocore.session from awscli.customizations.dlm.iam import IAM diff --git a/tests/unit/customizations/eks/test_kubeconfig.py b/tests/unit/customizations/eks/test_kubeconfig.py index 70c02e8c753c..00f1c4964850 100644 --- a/tests/unit/customizations/eks/test_kubeconfig.py +++ b/tests/unit/customizations/eks/test_kubeconfig.py @@ -15,7 +15,7 @@ import os import tempfile import shutil -from botocore.compat import OrderedDict +from collections import OrderedDict from awscli.testutils import mock, unittest, skip_if_windows from awscli.customizations.utils import uni_print diff --git a/tests/unit/customizations/eks/test_update_kubeconfig.py b/tests/unit/customizations/eks/test_update_kubeconfig.py index ecfae4e9395d..bc5356340154 100644 --- a/tests/unit/customizations/eks/test_update_kubeconfig.py +++ b/tests/unit/customizations/eks/test_update_kubeconfig.py @@ -17,9 +17,9 @@ import sys import tempfile from argparse import Namespace +from collections import OrderedDict import botocore -from botocore.compat import OrderedDict import awscli.customizations.eks.kubeconfig as kubeconfig from awscli.customizations.eks.exceptions import EKSClusterError, EKSError diff --git a/tests/unit/customizations/emr/test_create_cluster_release_label.py b/tests/unit/customizations/emr/test_create_cluster_release_label.py index 841f68ccf0d2..ab06a013230a 100644 --- a/tests/unit/customizations/emr/test_create_cluster_release_label.py +++ b/tests/unit/customizations/emr/test_create_cluster_release_label.py @@ -12,10 +12,9 @@ # language governing permissions and limitations under the License. import copy +import json import os - -from botocore.compat import json -from botocore.compat import OrderedDict +from collections import OrderedDict from tests.unit.customizations.emr import test_constants as \ CONSTANTS diff --git a/tests/unit/customizations/emr/test_create_default_role.py b/tests/unit/customizations/emr/test_create_default_role.py index c8ba5bd7c54a..35c26096a193 100644 --- a/tests/unit/customizations/emr/test_create_default_role.py +++ b/tests/unit/customizations/emr/test_create_default_role.py @@ -10,7 +10,8 @@ # 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 json +import json + from botocore.awsrequest import AWSResponse from botocore.exceptions import ClientError diff --git a/tests/unit/customizations/servicecatalog/test_generateproduct.py b/tests/unit/customizations/servicecatalog/test_generateproduct.py index 98fdcad2feaa..49ed1c62bcfe 100644 --- a/tests/unit/customizations/servicecatalog/test_generateproduct.py +++ b/tests/unit/customizations/servicecatalog/test_generateproduct.py @@ -11,13 +11,13 @@ # ANY KIND, either express or implied. See the License for the specific # language governing permissions and limitations under the License. +import json from argparse import Namespace from awscli.customizations.servicecatalog import exceptions from awscli.customizations.servicecatalog.generateproduct \ import GenerateProductCommand from awscli.testutils import unittest, mock, capture_output -from botocore.compat import json class TestCreateProductCommand(unittest.TestCase): diff --git a/tests/unit/customizations/servicecatalog/test_generateprovisioningartifact.py b/tests/unit/customizations/servicecatalog/test_generateprovisioningartifact.py index d08fb4c6ae7b..fda36cd132e9 100644 --- a/tests/unit/customizations/servicecatalog/test_generateprovisioningartifact.py +++ b/tests/unit/customizations/servicecatalog/test_generateprovisioningartifact.py @@ -11,13 +11,13 @@ # ANY KIND, either express or implied. See the License for the specific # language governing permissions and limitations under the License. +import json from argparse import Namespace from awscli.customizations.servicecatalog import exceptions from awscli.customizations.servicecatalog.generateprovisioningartifact \ import GenerateProvisioningArtifactCommand from awscli.testutils import unittest, mock, capture_output -from botocore.compat import json class TestCreateProvisioningArtifactCommand(unittest.TestCase): diff --git a/tests/unit/output/test_json_output.py b/tests/unit/output/test_json_output.py index 826380ec3453..8dae2d342a86 100644 --- a/tests/unit/output/test_json_output.py +++ b/tests/unit/output/test_json_output.py @@ -11,10 +11,10 @@ # 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 json +import json import platform -from awscli.formatter import JSONFormatter +from awscli.formatter import JSONFormatter from awscli.testutils import BaseAWSCommandParamsTest, unittest from awscli.testutils import mock, skip_if_windows from awscli.compat import StringIO, get_stdout_text_writer diff --git a/tests/unit/test_argprocess.py b/tests/unit/test_argprocess.py index e59eb6c3b64c..76654960d5b8 100644 --- a/tests/unit/test_argprocess.py +++ b/tests/unit/test_argprocess.py @@ -11,10 +11,10 @@ # ANY KIND, either express or implied. See the License for the specific # language governing permissions and limitations under the License. import json +from collections import OrderedDict from botocore import xform_name from botocore import model -from botocore.compat import OrderedDict from awscli.testutils import mock from awscli.testutils import unittest diff --git a/tests/unit/test_clidriver.py b/tests/unit/test_clidriver.py index b720b0347986..3fc81f1e0b4b 100644 --- a/tests/unit/test_clidriver.py +++ b/tests/unit/test_clidriver.py @@ -18,10 +18,10 @@ import io import sys import importlib +from collections import OrderedDict from botocore.awsrequest import AWSResponse from botocore.exceptions import NoCredentialsError -from botocore.compat import OrderedDict import botocore.model import awscli diff --git a/tests/unit/test_completer.py b/tests/unit/test_completer.py index d4dff96fad17..abaf6f647579 100644 --- a/tests/unit/test_completer.py +++ b/tests/unit/test_completer.py @@ -12,8 +12,8 @@ # language governing permissions and limitations under the License. import pprint import difflib +from collections import OrderedDict -from botocore.compat import OrderedDict from botocore.model import OperationModel from awscli.clidriver import ( CLIDriver, ServiceCommand, ServiceOperation, CLICommand) diff --git a/tests/unit/test_schema.py b/tests/unit/test_schema.py index bc914ae998e7..5ba58cf8949b 100644 --- a/tests/unit/test_schema.py +++ b/tests/unit/test_schema.py @@ -11,8 +11,7 @@ # ANY KIND, either express or implied. See the License for the specific # language governing permissions and limitations under the License. import pprint - -from botocore.compat import OrderedDict +from collections import OrderedDict from awscli.testutils import unittest from awscli.schema import ParameterRequiredError, SchemaTransformer From d3469bf2ede369791b6e95f6e88fc82f07a52cd1 Mon Sep 17 00:00:00 2001 From: Alexandre Detiste Date: Sun, 9 Feb 2025 16:25:06 +0100 Subject: [PATCH 3/3] typo --- awscli/customizations/eks/ordered_yaml.py | 2 +- awscli/customizations/emr/emrfsutils.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/awscli/customizations/eks/ordered_yaml.py b/awscli/customizations/eks/ordered_yaml.py index 4c75af535ebe..23de7f20914e 100644 --- a/awscli/customizations/eks/ordered_yaml.py +++ b/awscli/customizations/eks/ordered_yaml.py @@ -11,7 +11,7 @@ # ANY KIND, either express or implied. See the License for the specific # language governing permissions and limitations under the License. -from colelctions import OrderedDict +from collections import OrderedDict import yaml diff --git a/awscli/customizations/emr/emrfsutils.py b/awscli/customizations/emr/emrfsutils.py index 5c6b12609918..3c6251e43796 100644 --- a/awscli/customizations/emr/emrfsutils.py +++ b/awscli/customizations/emr/emrfsutils.py @@ -11,7 +11,7 @@ # ANY KIND, either express or implied. See the License for the specific # language governing permissions and limitations under the License. -from colelctions import OrderedDict +from collections import OrderedDict from awscli.customizations.emr import constants from awscli.customizations.emr import emrutils