diff --git a/awscli/customizations/ecs/exceptions.py b/awscli/customizations/ecs/exceptions.py index 0dbc564ef811..1f0d8888fe1c 100644 --- a/awscli/customizations/ecs/exceptions.py +++ b/awscli/customizations/ecs/exceptions.py @@ -18,7 +18,7 @@ class ECSError(Exception): def __init__(self, **kwargs): msg = self.fmt.format(**kwargs) - super(ECSError, self).__init__(msg) + super().__init__(msg) self.kwargs = kwargs diff --git a/awscli/customizations/ecs/executecommand.py b/awscli/customizations/ecs/executecommand.py index c2b45f1448b0..8025921a3651 100644 --- a/awscli/customizations/ecs/executecommand.py +++ b/awscli/customizations/ecs/executecommand.py @@ -36,7 +36,7 @@ class ECSExecuteCommand(ServiceOperation): def create_help_command(self): - help_command = super(ECSExecuteCommand, self).create_help_command() + help_command = super().create_help_command() # change the output shape because the command provides no output. self._operation_model.output_shape = None return help_command diff --git a/awscli/customizations/eks/update_kubeconfig.py b/awscli/customizations/eks/update_kubeconfig.py index a73d035015aa..7e08a175cecc 100644 --- a/awscli/customizations/eks/update_kubeconfig.py +++ b/awscli/customizations/eks/update_kubeconfig.py @@ -148,11 +148,11 @@ def _run_main(self, parsed_args, parsed_globals): writer.write_kubeconfig(config) if updating_existing: - uni_print("Updated context {0} in {1}\n".format( + uni_print("Updated context {} in {}\n".format( new_context_dict["name"], config.path )) else: - uni_print("Added new context {0} to {1}\n".format( + uni_print("Added new context {} to {}\n".format( new_context_dict["name"], config.path )) @@ -265,7 +265,7 @@ def cluster_description(self): if "status" not in self._cluster_description: raise EKSClusterError("Cluster not found") if self._cluster_description["status"] not in ["ACTIVE", "UPDATING"]: - raise EKSClusterError("Cluster status is {0}".format( + raise EKSClusterError("Cluster status is {}".format( self._cluster_description["status"] )) diff --git a/awscli/customizations/emr/applicationutils.py b/awscli/customizations/emr/applicationutils.py index 8a11eb3ab092..5e2f1a1f98f7 100644 --- a/awscli/customizations/emr/applicationutils.py +++ b/awscli/customizations/emr/applicationutils.py @@ -27,7 +27,6 @@ def build_applications(region, app_name = app_config['Name'].lower() if app_name == constants.HIVE: - hive_version = constants.LATEST step_list.append( _build_install_hive_step(region=region)) args = app_config.get('Args') @@ -40,7 +39,6 @@ def build_applications(region, region=region, hive_site_path=hive_site_path)) elif app_name == constants.PIG: - pig_version = constants.LATEST step_list.append( _build_pig_install_step( region=region)) @@ -62,8 +60,8 @@ def build_applications(region, constants.HBASE_PATH_HADOOP1_INSTALL_JAR)) else: raise ParamValidationError( - 'aws: error: AMI version %s is not ' - 'compatible with HBase.' % ami_version + f'aws: error: AMI version {ami_version} is not ' + 'compatible with HBase.' ) elif app_name == constants.IMPALA: ba_list.append( diff --git a/awscli/customizations/emr/command.py b/awscli/customizations/emr/command.py index 576537f016f5..9b4c59af4696 100644 --- a/awscli/customizations/emr/command.py +++ b/awscli/customizations/emr/command.py @@ -56,10 +56,10 @@ def _apply_configs(self, parsed_args, parsed_configs): parsed_configs[configuration.name] if configs_added: - LOG.debug("Updated arguments with configs: %s" % configs_added) + LOG.debug(f"Updated arguments with configs: {configs_added}") else: LOG.debug("No configs applied") - LOG.debug("Running command with args: %s" % parsed_args) + LOG.debug(f"Running command with args: {parsed_args}") def _get_applicable_configurations(self, parsed_args, parsed_configs): # We need to find the applicable configurations by applying diff --git a/awscli/customizations/emr/config.py b/awscli/customizations/emr/config.py index d835ed02d93f..be1f01fbaa5a 100644 --- a/awscli/customizations/emr/config.py +++ b/awscli/customizations/emr/config.py @@ -80,7 +80,7 @@ def _check_arg(self, parsed_args, arg_name): class StringConfiguration(Configuration): def __init__(self, name, arg_name, arg_value_key=None): - super(StringConfiguration, self).__init__(name, arg_name) + super().__init__(name, arg_name) self.arg_value_key = arg_value_key def is_applicable(self, command): @@ -105,7 +105,7 @@ def add(self, command, parsed_args, value): class BooleanConfiguration(Configuration): def __init__(self, name): - super(BooleanConfiguration, self).__init__(name, name) + super().__init__(name, name) self.no_version_arg_name = "no_" + name def is_applicable(self, command): diff --git a/awscli/customizations/emr/emrutils.py b/awscli/customizations/emr/emrutils.py index 3918ebd75ce8..5b9c2b7a0130 100644 --- a/awscli/customizations/emr/emrutils.py +++ b/awscli/customizations/emr/emrutils.py @@ -244,7 +244,7 @@ def join(values, separator=',', lastSeparator='and'): elif len(values) == 1: return values[0] else: - separator = '%s ' % separator + separator = f'{separator} ' return ' '.join([separator.join(values[:-1]), lastSeparator, values[-1]]) diff --git a/awscli/customizations/emr/ssh.py b/awscli/customizations/emr/ssh.py index ae4cb71ceb17..345870f5d56a 100644 --- a/awscli/customizations/emr/ssh.py +++ b/awscli/customizations/emr/ssh.py @@ -28,7 +28,7 @@ class Socks(Command): NAME = 'socks' DESCRIPTION = ('Create a socks tunnel on port 8157 from your machine ' - 'to the master.\n%s' % KEY_PAIR_FILE_HELP_TEXT) + f'to the master.\n{KEY_PAIR_FILE_HELP_TEXT}') ARG_TABLE = [ {'name': 'cluster-id', 'required': True, 'help_text': 'Cluster Id of cluster you want to ssh into'}, @@ -45,7 +45,7 @@ def _run_main_command(self, parsed_args, parsed_globals): key_file = parsed_args.key_pair_file sshutils.validate_ssh_with_key_file(key_file) - f = tempfile.NamedTemporaryFile(delete=False) + tempfile.NamedTemporaryFile(delete=False) if (emrutils.which('ssh') or emrutils.which('ssh.exe')): command = ['ssh', '-o', 'StrictHostKeyChecking=no', '-o', 'ServerAliveInterval=10', '-ND', '8157', '-i', @@ -66,8 +66,7 @@ def _run_main_command(self, parsed_args, parsed_globals): class SSH(Command): NAME = 'ssh' - DESCRIPTION = ('SSH into master node of the cluster.\n%s' % - KEY_PAIR_FILE_HELP_TEXT) + DESCRIPTION = (f'SSH into master node of the cluster.\n{KEY_PAIR_FILE_HELP_TEXT}') ARG_TABLE = [ {'name': 'cluster-id', 'required': True, 'help_text': 'Cluster Id of cluster you want to ssh into'}, @@ -110,8 +109,7 @@ def _run_main_command(self, parsed_args, parsed_globals): class Put(Command): NAME = 'put' - DESCRIPTION = ('Put file onto the master node.\n%s' % - KEY_PAIR_FILE_HELP_TEXT) + DESCRIPTION = (f'Put file onto the master node.\n{KEY_PAIR_FILE_HELP_TEXT}') ARG_TABLE = [ {'name': 'cluster-id', 'required': True, 'help_text': 'Cluster Id of cluster you want to put file onto'}, @@ -150,7 +148,7 @@ def _run_main_command(self, parsed_args, parsed_globals): class Get(Command): NAME = 'get' - DESCRIPTION = ('Get file from master node.\n%s' % KEY_PAIR_FILE_HELP_TEXT) + DESCRIPTION = (f'Get file from master node.\n{KEY_PAIR_FILE_HELP_TEXT}') ARG_TABLE = [ {'name': 'cluster-id', 'required': True, 'help_text': 'Cluster Id of cluster you want to get file from'},