Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix pre-existing linting errors #2

Merged
merged 2 commits into from
May 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ unlink-packages: ## Unlink local packages from virtualenv
#######################

lint-black: $(INSTALL_STAMP) ## Run black (check only)
$(VENV_BIN)/black ./ --check
$(VENV_BIN)/black ./ --diff --check

lint-isort: $(INSTALL_STAMP) ## Run isort (check only)
$(VENV_BIN)/isort ./ --check
Expand Down
12 changes: 6 additions & 6 deletions src/aibs_informatics_cdk_lib/constructs_/efs/file_system.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,9 @@ def __init__(
scope,
id,
vpc=vpc,
file_system_name=self.get_name_with_env(file_system_name)
if file_system_name
else None,
file_system_name=(
self.get_name_with_env(file_system_name) if file_system_name else None
),
allow_anonymous_access=allow_anonymous_access,
enable_automatic_backups=enable_automatic_backups,
encrypted=encrypted,
Expand Down Expand Up @@ -158,9 +158,9 @@ def __init__(
self,
"fs",
env_base=self.env_base,
file_system_name=self.get_name_with_env(file_system_name)
if file_system_name
else None,
file_system_name=(
self.get_name_with_env(file_system_name) if file_system_name else None
),
lifecycle_policy=efs.LifecyclePolicy.AFTER_7_DAYS,
out_of_infrequent_access_policy=efs.OutOfInfrequentAccessPolicy.AFTER_1_ACCESS,
enable_automatic_backups=False,
Expand Down
16 changes: 10 additions & 6 deletions src/aibs_informatics_cdk_lib/constructs_/monitoring.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,11 @@ def add_function_widgets(
self.dashboard_tools.add_text_widget(f"{group_name} Lambda Functions", 1)

function_names_groups: List[Tuple[str, List[str]]] = [
cast(Tuple[str, List[str]], _)
if isinstance(_, tuple) and len(_) == 2 and isinstance(_[-1], list)
else ("/".join(_), _)
(
cast(Tuple[str, List[str]], _)
if isinstance(_, tuple) and len(_) == 2 and isinstance(_[-1], list)
else ("/".join(_), _)
)
for _ in function_names_groups
]

Expand Down Expand Up @@ -184,9 +186,11 @@ def add_state_machine_widgets(
*grouped_state_machine_names: Union[Tuple[str, List[str]], List[str]],
):
grouped_state_machine_names: List[Tuple[str, List[str]]] = [
cast(Tuple[str, List[str]], _)
if isinstance(_, tuple) and len(_) == 2 and isinstance(_[-1], list)
else ("/".join(_), _)
(
cast(Tuple[str, List[str]], _)
if isinstance(_, tuple) and len(_) == 2 and isinstance(_[-1], list)
else ("/".join(_), _)
)
for _ in grouped_state_machine_names
]
self.dashboard_tools.add_text_widget(f"{group_name} State Machines", 1)
Expand Down
4 changes: 1 addition & 3 deletions src/aibs_informatics_cdk_lib/constructs_/ssm/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,7 @@ def upload_file(
)

# Store the S3 URI location in an SSM parameter
s3_uri = S3URI.build(
destination_bucket.bucket_name, destination_key, full_validate=False
)
s3_uri = S3URI.build(destination_bucket.bucket_name, destination_key, full_validate=False)

parameter_name = self.env_base.get_ssm_param_name(*param_name_components)
cmd_wrapper_param = ssm.StringParameter(
Expand Down
39 changes: 20 additions & 19 deletions src/aibs_informatics_cdk_lib/stacks/data_sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,6 @@ def code_asset(self) -> CodeAsset:
return self._code_asset

def create_lambda_functions(self) -> None:

# ----------------------------------------------------------
# Data Transfer functions
# ----------------------------------------------------------
Expand Down Expand Up @@ -251,7 +250,6 @@ def create_lambda_functions(self) -> None:
self.add_managed_policies(self.prepare_batch_data_sync_fn.role, "AmazonS3ReadOnlyAccess")

def create_step_functions(self):

start_pass_state = sfn.Pass(
self,
"Data Sync: Start",
Expand Down Expand Up @@ -300,14 +298,16 @@ def create_step_functions(self):
},
)
],
platform_capabilities=["FARGATE"]
if any(
[
isinstance(ce.compute_environment, batch.FargateComputeEnvironment)
for ce in self._job_queue.compute_environments
]
)
else None,
platform_capabilities=(
["FARGATE"]
if any(
[
isinstance(ce.compute_environment, batch.FargateComputeEnvironment)
for ce in self._job_queue.compute_environments
]
)
else None
),
)
)
# fmt: off
Expand Down Expand Up @@ -360,7 +360,6 @@ def create_step_functions(self):
)

def create_rclone_step_function(self):

start_pass_state = sfn.Pass(
self,
"Rclone: Start",
Expand Down Expand Up @@ -413,14 +412,16 @@ def create_rclone_step_function(self):
},
)
],
platform_capabilities=["FARGATE"]
if any(
[
isinstance(ce.compute_environment, batch.FargateComputeEnvironment)
for ce in self._job_queue.compute_environments
]
)
else None,
platform_capabilities=(
["FARGATE"]
if any(
[
isinstance(ce.compute_environment, batch.FargateComputeEnvironment)
for ce in self._job_queue.compute_environments
]
)
else None
),
)
)
# fmt: off
Expand Down
Loading