File tree Expand file tree Collapse file tree 1 file changed +14
-8
lines changed Expand file tree Collapse file tree 1 file changed +14
-8
lines changed Original file line number Diff line number Diff line change @@ -149,19 +149,25 @@ def notebook_execute(options, status):
149149 # complete progress if necessary
150150 if (not quiet ) and created :
151151 status ("Done\n " )
152-
153- # compute total code cells (for progress)
152+
154153 current_code_cell = 1
155- total_code_cells = sum (cell .cell_type == 'code' for cell in client .nb .cells )
154+ total_code_cells = 0
155+ cell_labels = []
156+ max_label_len = 0
156157
157- # find max label length (for progress)
158- max_label_len = max (len (nb_cell_yaml_options (client .nb .metadata .kernelspec .language , cell ).get ('label' , '' )) for cell in client .nb .cells )
158+ for cell in client .nb .cells :
159+ # compute total code cells (for progress)
160+ if cell .cell_type == 'code' :
161+ total_code_cells += 1
162+ # map cells to their labels
163+ label = nb_cell_yaml_options (client .nb .metadata .kernelspec .language , cell ).get ('label' , '' )
164+ cell_labels .append (label )
165+ # find max label length
166+ max_label_len = max (max_label_len , len (label ))
159167
160168 # execute the cells
161169 for index , cell in enumerate (client .nb .cells ):
162- # read cell options
163- cell_options = nb_cell_yaml_options (client .nb .metadata .kernelspec .language , cell )
164- cell_label = cell_options .get ('label' , '' )
170+ cell_label = cell_labels [index ]
165171 padding = "." * (max_label_len - len (cell_label ))
166172
167173 # progress
You can’t perform that action at this time.
0 commit comments