Skip to content

Commit 85de4b9

Browse files
icywang86ruiRui Wang Napieralskiajaykarpur
authored
fix: v2 upgrade tool should ignore cell starting with '%' (#2013)
Co-authored-by: Rui Wang Napieralski <[email protected]> Co-authored-by: Ajay Karpur <[email protected]>
1 parent 6720a19 commit 85de4b9

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

src/sagemaker/cli/compatibility/v2/files.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ def _contains_shell_cmds(self, cell):
140140
"""
141141
source = cell["source"]
142142

143-
if source[0].startswith("%%"):
143+
if source[0].startswith("%"):
144144
return True
145145

146146
return any(line.startswith("!") for line in source)

tests/unit/sagemaker/cli/compatibility/v2/test_file_updaters.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,16 @@ def test_update(ast_transformer, pasta_parse, pasta_dump, json_dump):
114114
"execution_count": 3,
115115
"metadata": {},
116116
"outputs": [],
117+
"source": [
118+
"%%cd\\n",
119+
"echo ignore this too"
120+
]
121+
},
122+
{
123+
"cell_type": "code",
124+
"execution_count": 4,
125+
"metadata": {},
126+
"outputs": [],
117127
"source": [
118128
"# code to be modified\\n",
119129
"%s"

0 commit comments

Comments
 (0)