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