File tree Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Original file line number Diff line number Diff line change @@ -32,7 +32,7 @@ def _filter(data: Any, remove: str) -> Any:
32
32
# Move the comment that belongs to the removed key (which comes _after_ the removed key)
33
33
# to the preceding key
34
34
curr .ca .items [prev_key ] = data .ca .items .pop (remove )
35
- else :
35
+ elif prev_key in data . ca . items :
36
36
# If the removed key does not have a comment,
37
37
# the comment after the previous key should be removed
38
38
curr .ca .items .pop (prev_key )
@@ -210,7 +210,8 @@ def upgrade_problem_yaml(problem_path: Path, bar: ProgressBar) -> None:
210
210
if not type :
211
211
type .append ("pass-fail" )
212
212
# "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 ])
214
215
_filter (data , "validation" )
215
216
216
217
if "author" in data :
You can’t perform that action at this time.
0 commit comments