@@ -112,29 +112,27 @@ def output_pretty_table(days, output_file=None):
112
112
for day , hours in days .items ():
113
113
col_widths [0 ] = max (col_widths [0 ], len (CRON_TO_DAY [day ]))
114
114
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 ]))))
116
117
117
118
top_border = "┌" + "┬" .join ("─" * width for width in col_widths ) + "┐"
118
119
print (top_border , file = output )
119
120
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
+ "│" )
125
125
print (header_row , file = output )
126
126
header_sep = "├" + "┼" .join ("─" * width for width in col_widths ) + "┤"
127
127
print (header_sep , file = output )
128
128
129
129
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
+ "│" )
138
136
print (data_row , file = output )
139
137
140
138
# Bottom border
@@ -144,17 +142,17 @@ def output_pretty_table(days, output_file=None):
144
142
145
143
def parse_args ():
146
144
parser = argparse .ArgumentParser (
147
- description = "Visualize build distribution across days and hours"
148
- )
145
+ description = "Visualize build distribution across days and hours" )
149
146
parser .add_argument (
150
147
"--format" ,
151
148
choices = ["table" , "csv" , "pretty" ],
152
149
default = "pretty" ,
153
150
help = "Output format (default: pretty)" ,
154
151
)
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)" )
158
156
return parser .parse_args ()
159
157
160
158
@@ -175,7 +173,7 @@ def main():
175
173
output_pretty_table (days , output_file )
176
174
else : # regular table
177
175
if (
178
- output_file
176
+ output_file
179
177
): # evil hack so I don't have to rewrite visualize_data() prints
180
178
original_stdout = sys .stdout
181
179
sys .stdout = output_file
0 commit comments