Skip to content

Commit 612ffda

Browse files
mzuennimpsijm
authored andcommitted
fix errors
1 parent 7bb4dd0 commit 612ffda

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

bin/upgrade.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ def _filter(data: Any, remove: str) -> Any:
3232
# Move the comment that belongs to the removed key (which comes _after_ the removed key)
3333
# to the preceding key
3434
curr.ca.items[prev_key] = data.ca.items.pop(remove)
35-
else:
35+
elif prev_key in data.ca.items:
3636
# If the removed key does not have a comment,
3737
# the comment after the previous key should be removed
3838
curr.ca.items.pop(prev_key)
@@ -210,7 +210,8 @@ def upgrade_problem_yaml(problem_path: Path, bar: ProgressBar) -> None:
210210
if not type:
211211
type.append("pass-fail")
212212
# "type" comes before "name" in the spec
213-
data.insert(list(data.keys()).index("name"), "type", type if len(type) > 1 else type[0])
213+
pos = list(data.keys()).index("name") if "name" in data else 0
214+
data.insert(pos, "type", type if len(type) > 1 else type[0])
214215
_filter(data, "validation")
215216

216217
if "author" in data:

0 commit comments

Comments
 (0)