Skip to content

Commit 56a4ff9

Browse files
akuma12akrishna1995
authored andcommitted
More lint fixes
1 parent 5a09716 commit 56a4ff9

File tree

2 files changed

+18
-14
lines changed

2 files changed

+18
-14
lines changed

src/sagemaker/processing.py

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1865,9 +1865,7 @@ def _get_codeartifact_command(self, codeartifact_repo_arn: str) -> str:
18651865
)
18661866
m = re.match(arn_regex, codeartifact_repo_arn)
18671867
if not m:
1868-
raise ValueError(
1869-
"invalid CodeArtifact repository arn {}".format(codeartifact_repo_arn)
1870-
)
1868+
raise ValueError("invalid CodeArtifact repository arn {}".format(codeartifact_repo_arn))
18711869
domain = m.group("domain")
18721870
owner = m.group("account")
18731871
repository = m.group("repository")
@@ -1903,12 +1901,11 @@ def _generate_framework_script(
19031901
logged into before installing dependencies (default: None).
19041902
"""
19051903
if codeartifact_repo_arn:
1906-
codeartifact_login_command = self._get_codeartifact_command(
1907-
codeartifact_repo_arn
1908-
)
1904+
codeartifact_login_command = self._get_codeartifact_command(codeartifact_repo_arn)
19091905
else:
1910-
codeartifact_login_command = \
1906+
codeartifact_login_command = (
19111907
"echo 'CodeArtifact repository not specified. Skipping login.'"
1908+
)
19121909

19131910
return dedent(
19141911
"""\
@@ -2031,9 +2028,7 @@ def _create_and_upload_runproc(
20312028
from sagemaker.workflow.utilities import _pipeline_config, hash_object
20322029

20332030
if _pipeline_config and _pipeline_config.pipeline_name:
2034-
runproc_file_str = self._generate_framework_script(
2035-
user_script, codeartifact_repo_arn
2036-
)
2031+
runproc_file_str = self._generate_framework_script(user_script, codeartifact_repo_arn)
20372032
runproc_file_hash = hash_object(runproc_file_str)
20382033
s3_uri = s3.s3_path_join(
20392034
"s3://",

tests/unit/test_processing.py

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1105,7 +1105,9 @@ def test_pyspark_processor_configuration_path_pipeline_config(
11051105

11061106
@patch("sagemaker.workflow.utilities._pipeline_config", MOCKED_PIPELINE_CONFIG)
11071107
def test_get_codeartifact_command(pipeline_session):
1108-
codeartifact_repo_arn = "arn:aws:codeartifact:us-west-2:012345678901:repository/test-domain/test-repository"
1108+
codeartifact_repo_arn = (
1109+
"arn:aws:codeartifact:us-west-2:012345678901:repository/test-domain/test-repository"
1110+
)
11091111

11101112
processor = PyTorchProcessor(
11111113
role=ROLE,
@@ -1116,9 +1118,14 @@ def test_get_codeartifact_command(pipeline_session):
11161118
sagemaker_session=pipeline_session,
11171119
)
11181120

1119-
codeartifact_command = processor._get_codeartifact_command(codeartifact_repo_arn=codeartifact_repo_arn)
1121+
codeartifact_command = processor._get_codeartifact_command(
1122+
codeartifact_repo_arn=codeartifact_repo_arn
1123+
)
11201124

1121-
assert codeartifact_command == "aws codeartifact login --tool pip --domain test-domain --domain-owner 012345678901 --repository test-repository --region us-west-2" # noqa: E501
1125+
assert (
1126+
codeartifact_command
1127+
== "aws codeartifact login --tool pip --domain test-domain --domain-owner 012345678901 --repository test-repository --region us-west-2"
1128+
) # noqa: E501
11221129

11231130

11241131
@patch("sagemaker.workflow.utilities._pipeline_config", MOCKED_PIPELINE_CONFIG)
@@ -1193,7 +1200,9 @@ def test_generate_framework_script_with_codeartifact(pipeline_session):
11931200

11941201
framework_script = processor._generate_framework_script(
11951202
user_script="process.py",
1196-
codeartifact_repo_arn="arn:aws:codeartifact:us-west-2:012345678901:repository/test-domain/test-repository"
1203+
codeartifact_repo_arn=(
1204+
"arn:aws:codeartifact:us-west-2:012345678901:repository/test-domain/test-repository"
1205+
),
11971206
)
11981207

11991208
assert framework_script == dedent(

0 commit comments

Comments
 (0)