Skip to content

Commit

Permalink
Run ruff check --fix
Browse files Browse the repository at this point in the history
  • Loading branch information
kdaily committed Dec 23, 2024
1 parent 7be8454 commit a439920
Show file tree
Hide file tree
Showing 12 changed files with 25 additions and 28 deletions.
8 changes: 4 additions & 4 deletions awscli/customizations/ecs/deploy.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ def _get_file_contents(self, file_path):
try:
with compat_open(full_path) as f:
return f.read()
except (OSError, IOError, UnicodeDecodeError) as e:
except (OSError, UnicodeDecodeError) as e:
raise exceptions.FileLoadError(
file_path=file_path, error=e)

Expand Down Expand Up @@ -212,7 +212,7 @@ def _validate_code_deploy_resources(self, client):
self._cd_validator = validator


class CodeDeployer():
class CodeDeployer:

MSG_WAITING = ("Waiting for {deployment_id} to succeed "
"(will wait up to {wait} minutes)...\n")
Expand Down Expand Up @@ -320,7 +320,7 @@ def _show_deploy_wait_msg(self, id, wait_min):
sys.stdout.flush()


class CodeDeployValidator():
class CodeDeployValidator:
def __init__(self, cd_client, resources):
self._client = cd_client
self._resource_names = resources
Expand Down Expand Up @@ -402,7 +402,7 @@ def validate_deployment_group(self):
dg_name=dgp, resource='cluster', resource_name=cluster)


class ECSClient():
class ECSClient:

def __init__(self, session, parsed_args, parsed_globals, user_agent_extra):
self._args = parsed_args
Expand Down
3 changes: 1 addition & 2 deletions awscli/customizations/ecs/executecommand.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,7 @@ def build_ssm_request_paramaters(response, client):
container_runtime_id = \
get_container_runtime_id(client, container_name,
task_id, cluster_name)
target = "ecs:{}_{}_{}".format(cluster_name, task_id,
container_runtime_id)
target = f"ecs:{cluster_name}_{task_id}_{container_runtime_id}"
ssm_request_params = {"Target": target}
return ssm_request_params

Expand Down
4 changes: 2 additions & 2 deletions awscli/customizations/eks/get_token.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ def discover_api_version(self):
return fallback_api_version


class TokenGenerator(object):
class TokenGenerator:
def __init__(self, sts_client):
self._sts_client = sts_client

Expand All @@ -236,7 +236,7 @@ def _get_presigned_url(self, k8s_aws_id):
)


class STSClientFactory(object):
class STSClientFactory:
def __init__(self, session):
self._session = session

Expand Down
14 changes: 7 additions & 7 deletions awscli/customizations/eks/kubeconfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def _get_new_kubeconfig_content():
])


class Kubeconfig(object):
class Kubeconfig:
def __init__(self, path, content=None):
self.path = path
if content is None:
Expand Down Expand Up @@ -78,7 +78,7 @@ def __eq__(self, other):
)


class KubeconfigValidator(object):
class KubeconfigValidator:
def __init__(self):
# Validation_content is an empty Kubeconfig
# It is used as a way to know what types different entries should be
Expand Down Expand Up @@ -133,7 +133,7 @@ def _validate_list_entry_types(self, config):
f"Entry in {key} not a {dict}. ")


class KubeconfigLoader(object):
class KubeconfigLoader:
def __init__(self, validator = None):
if validator is None:
validator=KubeconfigValidator()
Expand All @@ -159,7 +159,7 @@ def load_kubeconfig(self, path):
try:
with compat_open(path, "r") as stream:
loaded_content = ordered_yaml_load(stream)
except IOError as e:
except OSError as e:
if e.errno == errno.ENOENT:
loaded_content=None
else:
Expand All @@ -175,7 +175,7 @@ def load_kubeconfig(self, path):
return loaded_config


class KubeconfigWriter(object):
class KubeconfigWriter:
def write_kubeconfig(self, config):
"""
Write config to disk.
Expand All @@ -199,12 +199,12 @@ def write_kubeconfig(self, config):
with compat_open(
config.path, "w+", access_permissions=0o600) as stream:
ordered_yaml_dump(config.content, stream)
except IOError as e:
except OSError as e:
raise KubeconfigInaccessableError(
f"Can't open kubeconfig for writing: {e}")


class KubeconfigAppender(object):
class KubeconfigAppender:
def insert_entry(self, config, key, new_entry):
"""
Insert entry into the entries list at content[key]
Expand Down
10 changes: 4 additions & 6 deletions awscli/customizations/eks/update_kubeconfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ def _run_main(self, parsed_args, parsed_globals):
return 0


class KubeconfigSelector(object):
class KubeconfigSelector:

def __init__(self, env_variable, path_in, validator=None,
loader=None):
Expand Down Expand Up @@ -219,12 +219,10 @@ def choose_kubeconfig(self, cluster_name):
loaded_config = self._loader.load_kubeconfig(candidate_path)

if loaded_config.has_cluster(cluster_name):
LOG.debug("Found entry to update at {0}".format(
candidate_path
))
LOG.debug(f"Found entry to update at {candidate_path}")
return loaded_config
except KubeconfigError as e:
LOG.warning("Passing {0}:{1}".format(candidate_path, e))
LOG.warning(f"Passing {candidate_path}:{e}")

# No entry was found, use the first file in KUBECONFIG
#
Expand All @@ -236,7 +234,7 @@ def _expand_path(self, path):
return os.path.abspath(os.path.expanduser(path))


class EKSClient(object):
class EKSClient:
def __init__(self, session, parsed_args, parsed_globals=None):
self._session = session
self._cluster_name = parsed_args.cluster_name
Expand Down
2 changes: 1 addition & 1 deletion awscli/customizations/emr/command.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class Command(BasicCommand):
])

def supports_arg(self, name):
return any((x['name'] == name for x in self.ARG_TABLE))
return any(x['name'] == name for x in self.ARG_TABLE)

def _run_main(self, parsed_args, parsed_globals):

Expand Down
2 changes: 1 addition & 1 deletion awscli/customizations/emr/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def _create_supported_configurations():
for config in SUPPORTED_CONFIG_LIST]


class Configuration(object):
class Configuration:

def __init__(self, name, arg_name):
self.name = name
Expand Down
2 changes: 1 addition & 1 deletion awscli/customizations/emr/configutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def update_roles(session):
LOG.debug("Associated default roles with your current profile")


class ConfigWriter(object):
class ConfigWriter:

def __init__(self, session):
self.session = session
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 @@ -133,7 +133,7 @@ def build_bootstrap_action(
def build_s3_link(relative_path='', region='us-east-1'):
if region is None:
region = 'us-east-1'
return 's3://{0}.elasticmapreduce{1}'.format(region, relative_path)
return f's3://{region}.elasticmapreduce{relative_path}'


def get_script_runner(region='us-east-1'):
Expand Down
2 changes: 1 addition & 1 deletion awscli/customizations/emrcontainers/base36.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# language governing permissions and limitations under the License.


class Base36(object):
class Base36:
def str_to_int(self, request):
"""Method to convert given string into decimal representation"""
result = 0
Expand Down
2 changes: 1 addition & 1 deletion awscli/customizations/emrcontainers/eks.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# language governing permissions and limitations under the License.


class EKS(object):
class EKS:
def __init__(self, eks_client):
self.eks_client = eks_client
self.cluster_info = {}
Expand Down
2 changes: 1 addition & 1 deletion awscli/customizations/emrcontainers/iam.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import json


class IAM(object):
class IAM:
def __init__(self, iam_client):
self.iam_client = iam_client

Expand Down

0 comments on commit a439920

Please sign in to comment.