File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -12,17 +12,17 @@ def _is_header_line(line: str) -> bool:
1212
1313
1414def _migrate_map (contents : str ) -> str :
15- # Find the first non-header line
16- lines = contents .splitlines (True )
17- i = 0
18- # Only loop on non empty configuration file
19- while i < len (lines ) and _is_header_line (lines [i ]):
20- i += 1
15+ if isinstance (yaml_load (contents ), list ):
16+ # Find the first non-header line
17+ lines = contents .splitlines (True )
18+ i = 0
19+ # Only loop on non empty configuration file
20+ while i < len (lines ) and _is_header_line (lines [i ]):
21+ i += 1
2122
22- header = '' .join (lines [:i ])
23- rest = '' .join (lines [i :])
23+ header = '' .join (lines [:i ])
24+ rest = '' .join (lines [i :])
2425
25- if isinstance (yaml_load (contents ), list ):
2626 # If they are using the "default" flow style of yaml, this operation
2727 # will yield a valid configuration
2828 try :
You can’t perform that action at this time.
0 commit comments