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:
101
101
with open (output_filename , "r" ) as f :
102
102
lines = f .readlines ()
103
103
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
111
112
112
113
banner_comment_lines = [
113
114
"/* tslint:disable */\n " ,
@@ -118,7 +119,10 @@ def clean_output_file(output_filename: str) -> None:
118
119
"*/\n \n " ,
119
120
]
120
121
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 } " )
122
126
123
127
with open (output_filename , "w" ) as f :
124
128
f .writelines (new_lines )
You can’t perform that action at this time.
0 commit comments