File tree Expand file tree Collapse file tree 1 file changed +12
-11
lines changed Expand file tree Collapse file tree 1 file changed +12
-11
lines changed Original file line number Diff line number Diff line change @@ -164,23 +164,24 @@ def main():
164
164
165
165
output_file = None
166
166
if args .output :
167
- output_file = open (args .output , "w" , newline = "" )
167
+ # pylint: disable-next=consider-using-with
168
+ output_file = open ( # noqa: SIM115
169
+ args .output , "w" , encoding = "utf-8" , newline = "" )
168
170
169
171
try :
170
172
if args .format == "csv" :
171
173
output_csv (days , output_file )
172
174
elif args .format == "pretty" :
173
175
output_pretty_table (days , output_file )
174
- else : # regular table
175
- if (
176
- output_file
177
- ): # evil hack so I don't have to rewrite visualize_data() prints
178
- original_stdout = sys .stdout
179
- sys .stdout = output_file
180
- visualize_data (days )
181
- sys .stdout = original_stdout
182
- else :
183
- visualize_data (days )
176
+ # regular table
177
+ elif output_file :
178
+ # evil hack so I don't have to rewrite visualize_data() prints
179
+ original_stdout = sys .stdout
180
+ sys .stdout = output_file
181
+ visualize_data (days )
182
+ sys .stdout = original_stdout
183
+ else :
184
+ visualize_data (days )
184
185
finally :
185
186
if output_file :
186
187
output_file .close ()
You can’t perform that action at this time.
0 commit comments