Skip to content

Commit 9546f96

Browse files
author
Chuyang Deng
committed
remove unnecessary check
1 parent b9899ec commit 9546f96

File tree

1 file changed

+17
-20
lines changed

1 file changed

+17
-20
lines changed

src/sagemaker/cli/compatibility/v2/modifiers/image_uris.py

Lines changed: 17 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -79,26 +79,23 @@ def modify_node(self, node):
7979
if arg:
8080
args.append(arg)
8181

82-
if matching.matches_name(node, GET_IMAGE_URI_NAME) or matching.matches_attr(
83-
node, GET_IMAGE_URI_NAME
84-
):
85-
func = node.func
86-
has_sagemaker = False
87-
while hasattr(func, "value"):
88-
if hasattr(func.value, "id") and func.value.id == "sagemaker":
89-
has_sagemaker = True
90-
break
91-
func = func.value
92-
93-
if has_sagemaker:
94-
node.func = ast.Attribute(
95-
value=ast.Attribute(attr="image_uris", value=ast.Name(id="sagemaker")),
96-
attr="retrieve",
97-
)
98-
else:
99-
node.func = ast.Attribute(value=ast.Name(id="image_uris"), attr="retrieve")
100-
node.args = args
101-
node.keywords = []
82+
func = node.func
83+
has_sagemaker = False
84+
while hasattr(func, "value"):
85+
if hasattr(func.value, "id") and func.value.id == "sagemaker":
86+
has_sagemaker = True
87+
break
88+
func = func.value
89+
90+
if has_sagemaker:
91+
node.func = ast.Attribute(
92+
value=ast.Attribute(attr="image_uris", value=ast.Name(id="sagemaker")),
93+
attr="retrieve",
94+
)
95+
else:
96+
node.func = ast.Attribute(value=ast.Name(id="image_uris"), attr="retrieve")
97+
node.args = args
98+
node.keywords = []
10299
return node
103100

104101

0 commit comments

Comments
 (0)