Skip to content

Commit 14d65f4

Browse files
icywang86ruiWang Napieralski
andauthored
fix: remove duplicated tags in _append_project_tags (#2419)
Co-authored-by: Wang Napieralski <[email protected]>
1 parent 98bc8bb commit 14d65f4

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

src/sagemaker/_studio.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ def _append_project_tags(tags=None, working_dir=None):
4646
return tags
4747

4848
all_tags = tags or []
49+
additional_tags = [tag for tag in additional_tags if tag not in all_tags]
4950
all_tags.extend(additional_tags)
5051

5152
return all_tags

tests/unit/sagemaker/test_studio.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,3 +94,11 @@ def test_append_project_tags(tmpdir):
9494
{"Key": "sagemaker:project-id", "Value": "proj-1234"},
9595
{"Key": "sagemaker:project-name", "Value": "proj-name"},
9696
]
97+
98+
tags = _append_project_tags(
99+
[{"Key": "sagemaker:project-id", "Value": "proj-1234"}], working_dir
100+
)
101+
assert tags == [
102+
{"Key": "sagemaker:project-id", "Value": "proj-1234"},
103+
{"Key": "sagemaker:project-name", "Value": "proj-name"},
104+
]

0 commit comments

Comments
 (0)