@@ -112,29 +112,27 @@ def output_pretty_table(days, output_file=None):
112112 for day , hours in days .items ():
113113 col_widths [0 ] = max (col_widths [0 ], len (CRON_TO_DAY [day ]))
114114 for hour in range (HOURS ):
115- col_widths [hour + 1 ] = max (col_widths [hour + 1 ], len (str (len (hours [hour ]))))
115+ col_widths [hour + 1 ] = max (col_widths [hour + 1 ],
116+ len (str (len (hours [hour ]))))
116117
117118 top_border = "┌" + "┬" .join ("─" * width for width in col_widths ) + "┐"
118119 print (top_border , file = output )
119120
120- header_row = (
121- "│"
122- + "│" .join (f"{ cell :^{width }} " for cell , width in zip (header_cells , col_widths ))
123- + "│"
124- )
121+ header_row = ("│" +
122+ "│" .join (f"{ cell :^{width }} "
123+ for cell , width in zip (header_cells , col_widths )) +
124+ "│" )
125125 print (header_row , file = output )
126126 header_sep = "├" + "┼" .join ("─" * width for width in col_widths ) + "┤"
127127 print (header_sep , file = output )
128128
129129 for day , hours in days .items ():
130- row_cells = [CRON_TO_DAY [day ]] + [
131- str (len (hours [hour ])) for hour in range (HOURS )
132- ]
133- data_row = (
134- "│"
135- + "│" .join (f"{ cell :^{width }} " for cell , width in zip (row_cells , col_widths ))
136- + "│"
137- )
130+ row_cells = [CRON_TO_DAY [day ]
131+ ] + [str (len (hours [hour ])) for hour in range (HOURS )]
132+ data_row = ("│" +
133+ "│" .join (f"{ cell :^{width }} "
134+ for cell , width in zip (row_cells , col_widths )) +
135+ "│" )
138136 print (data_row , file = output )
139137
140138 # Bottom border
@@ -144,17 +142,17 @@ def output_pretty_table(days, output_file=None):
144142
145143def parse_args ():
146144 parser = argparse .ArgumentParser (
147- description = "Visualize build distribution across days and hours"
148- )
145+ description = "Visualize build distribution across days and hours" )
149146 parser .add_argument (
150147 "--format" ,
151148 choices = ["table" , "csv" , "pretty" ],
152149 default = "pretty" ,
153150 help = "Output format (default: pretty)" ,
154151 )
155- parser .add_argument (
156- "--output" , "-o" , type = str , help = "Output file (default: stdout)"
157- )
152+ parser .add_argument ("--output" ,
153+ "-o" ,
154+ type = str ,
155+ help = "Output file (default: stdout)" )
158156 return parser .parse_args ()
159157
160158
@@ -175,7 +173,7 @@ def main():
175173 output_pretty_table (days , output_file )
176174 else : # regular table
177175 if (
178- output_file
176+ output_file
179177 ): # evil hack so I don't have to rewrite visualize_data() prints
180178 original_stdout = sys .stdout
181179 sys .stdout = output_file
0 commit comments