File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff 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 :
You can’t perform that action at this time.
0 commit comments