File tree Expand file tree Collapse file tree 1 file changed +12
-8
lines changed Expand file tree Collapse file tree 1 file changed +12
-8
lines changed Original file line number Diff line number Diff line change @@ -101,13 +101,14 @@ def clean_output_file(output_filename: str) -> None:
101101 with open (output_filename , "r" ) as f :
102102 lines = f .readlines ()
103103
104- start , end = None , None
105- for i , line in enumerate (lines ):
106- if line .rstrip ("\r \n " ) == "export interface _Master_ {" :
107- start = i
108- elif (start is not None ) and line .rstrip ("\r \n " ) == "}" :
109- end = i
110- break
104+ start , end = 0 , 0
105+ if len (lines ) > 1 :
106+ for i , line in enumerate (lines ):
107+ if line .rstrip ("\r \n " ) == "export interface _Master_ {" :
108+ start = i
109+ elif (start is not None ) and line .rstrip ("\r \n " ) == "}" :
110+ end = i
111+ break
111112
112113 banner_comment_lines = [
113114 "/* tslint:disable */\n " ,
@@ -118,7 +119,10 @@ def clean_output_file(output_filename: str) -> None:
118119 "*/\n \n " ,
119120 ]
120121
121- new_lines = banner_comment_lines + lines [:start ] + lines [(end + 1 ) :]
122+ try :
123+ new_lines = banner_comment_lines + lines [:start ] + lines [(end + 1 ) :]
124+ except TypeError as err :
125+ raise TypeError (f"{ err } : output_filename: { output_filename } ; { lines } " )
122126
123127 with open (output_filename , "w" ) as f :
124128 f .writelines (new_lines )
You can’t perform that action at this time.
0 commit comments