Skip to content

Commit bdf984f

Browse files
committed
fix format
1 parent dca9f79 commit bdf984f

File tree

2 files changed

+12
-11
lines changed

2 files changed

+12
-11
lines changed

src/sagemaker/session.py

+8-6
Original file line numberDiff line numberDiff line change
@@ -3514,12 +3514,14 @@ def get_caller_identity_arn(self):
35143514
# Guessing this conditional's purpose was to handle lack of IAM permissions
35153515
# https://github.com/aws/sagemaker-python-sdk/issues/2089#issuecomment-791802713
35163516
if "AmazonSageMaker-ExecutionRole" in assumed_role:
3517-
LOGGER.warning('Assuming role was created in SageMaker AWS console, '
3518-
'as the name contains `AmazonSageMaker-ExecutionRole`. '
3519-
'Defaulting to Role ARN with service-role in path. '
3520-
'If this Role ARN is incorrect, please add '
3521-
'IAM read permissions to your role or supply the '
3522-
'Role Arn directly.')
3517+
LOGGER.warning(
3518+
"Assuming role was created in SageMaker AWS console, "
3519+
"as the name contains `AmazonSageMaker-ExecutionRole`. "
3520+
"Defaulting to Role ARN with service-role in path. "
3521+
"If this Role ARN is incorrect, please add "
3522+
"IAM read permissions to your role or supply the "
3523+
"Role Arn directly."
3524+
)
35233525
role = re.sub(
35243526
r"^(.+)sts::(\d+):assumed-role/(.+?)/.*$",
35253527
r"\1iam::\2:role/service-role/\3",

tests/unit/test_session.py

+4-5
Original file line numberDiff line numberDiff line change
@@ -406,15 +406,14 @@ def test_get_caller_identity_arn_from_an_execution_role(sts_regional_endpoint, b
406406
sess.boto_session.client("iam").get_role.return_value = {"Role": {"Arn": arn}}
407407

408408
actual = sess.get_caller_identity_arn()
409-
assert (
410-
actual
411-
== "arn:aws:iam::369233609183:role/AmazonSageMaker-ExecutionRole-20171129T072388"
412-
)
409+
assert actual == "arn:aws:iam::369233609183:role/AmazonSageMaker-ExecutionRole-20171129T072388"
413410

414411

415412
@patch("os.path.exists", side_effect=mock_exists(NOTEBOOK_METADATA_FILE, False))
416413
@patch("sagemaker.session.sts_regional_endpoint", return_value=STS_ENDPOINT)
417-
def test_get_caller_identity_arn_from_a_sagemaker_execution_role_with_iam_client_error(sts_regional_endpoint, boto_session):
414+
def test_get_caller_identity_arn_from_a_sagemaker_execution_role_with_iam_client_error(
415+
sts_regional_endpoint, boto_session
416+
):
418417
sess = Session(boto_session)
419418
arn = "arn:aws:sts::369233609183:assumed-role/AmazonSageMaker-ExecutionRole-20171129T072388/SageMaker"
420419
sess.boto_session.client("sts", endpoint_url=STS_ENDPOINT).get_caller_identity.return_value = {

0 commit comments

Comments
 (0)