Skip to content

Commit

Permalink
Run ruff check --fix --unsafe-fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
kdaily committed Dec 23, 2024
1 parent a439920 commit c63621e
Show file tree
Hide file tree
Showing 8 changed files with 17 additions and 21 deletions.
2 changes: 1 addition & 1 deletion awscli/customizations/ecs/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down
2 changes: 1 addition & 1 deletion awscli/customizations/ecs/executecommand.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions awscli/customizations/eks/update_kubeconfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
))

Expand Down Expand Up @@ -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"]
))

Expand Down
6 changes: 2 additions & 4 deletions awscli/customizations/emr/applicationutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand All @@ -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))
Expand All @@ -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(
Expand Down
4 changes: 2 additions & 2 deletions awscli/customizations/emr/command.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions awscli/customizations/emr/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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):
Expand Down
2 changes: 1 addition & 1 deletion awscli/customizations/emr/emrutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]])

Expand Down
12 changes: 5 additions & 7 deletions awscli/customizations/emr/ssh.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'},
Expand All @@ -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',
Expand All @@ -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'},
Expand Down Expand Up @@ -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'},
Expand Down Expand Up @@ -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'},
Expand Down

0 comments on commit c63621e

Please sign in to comment.