File tree Expand file tree Collapse file tree 1 file changed +10
-10
lines changed Expand file tree Collapse file tree 1 file changed +10
-10
lines changed Original file line number Diff line number Diff line change @@ -153,27 +153,27 @@ def notebook_execute(options, status):
153153 # compute total code cells (for progress)
154154 current_code_cell = 1
155155 total_code_cells = sum (cell .cell_type == 'code' for cell in client .nb .cells )
156-
157- # find max id length (for progress)
158- max_id_len = max (len (cell .id ) for cell in client .nb .cells )
159156
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 )
159+
160160 # execute the cells
161161 for index , cell in enumerate (client .nb .cells ):
162- # find cell id
163- source_list = cell . source . split ( ' \n ' )
164- cell_id = cell . id if any ( s . startswith ( "#| label" ) or s . startswith ( "#| id" ) for s in source_list ) else ""
165- padding = "." * (max_id_len - len (cell_id ))
166-
162+ # read cell options
163+ cell_options = nb_cell_yaml_options ( client . nb . metadata . kernelspec . language , cell )
164+ cell_label = cell_options . get ( ' label' , '' )
165+ padding = "." * (max_label_len - len (cell_label ))
166+
167167 # progress
168168 progress = (not quiet ) and cell .cell_type == 'code' and index > 0
169169 if progress :
170170 status (" Cell {0}/{1}: '{2}'{3}..." .format (
171171 current_code_cell - 1 ,
172172 total_code_cells - 1 ,
173- cell_id ,
173+ cell_label ,
174174 padding
175175 ))
176-
176+
177177 # clear cell output
178178 cell = cell_clear_output (cell )
179179
You can’t perform that action at this time.
0 commit comments