@@ -180,8 +180,7 @@ def render(self, grid: interfaces.renderers.TreeGrid) -> None:
180180
181181 def visitor (node : interfaces .renderers .TreeNode , accumulator ):
182182 line = []
183- for column_index in range (len (grid .columns )):
184- column = grid .columns [column_index ]
183+ for column_index , column in enumerate (grid .columns ):
185184 renderer = self ._type_renderers .get (
186185 column .type , self ._type_renderers ["default" ]
187186 )
@@ -261,8 +260,7 @@ def visitor(node: interfaces.renderers.TreeNode, accumulator):
261260 # Nodes always have a path value, giving them a path_depth of at least 1, we use max just in case
262261 row = {"TreeDepth" : str (max (0 , node .path_depth - 1 ))}
263262 line = []
264- for column_index in range (len (grid .columns )):
265- column = grid .columns [column_index ]
263+ for column_index , column in enumerate (grid .columns ):
266264 renderer = self ._type_renderers .get (
267265 column .type , self ._type_renderers ["default" ]
268266 )
@@ -326,8 +324,7 @@ def visitor(
326324
327325 line = {}
328326 rendered_line = []
329- for column_index in range (len (grid .columns )):
330- column = grid .columns [column_index ]
327+ for column_index , column in enumerate (grid .columns ):
331328 renderer = self ._type_renderers .get (
332329 column .type , self ._type_renderers ["default" ]
333330 )
@@ -357,8 +354,7 @@ def visitor(
357354 format_string_list = [
358355 "{0:<" + str (max_column_widths .get (tree_indent_column , 0 )) + "s}"
359356 ]
360- for column_index in range (len (grid .columns )):
361- column = grid .columns [column_index ]
357+ for column_index , column in enumerate (grid .columns ):
362358 format_string_list .append (
363359 "{"
364360 + str (column_index + 1 )
@@ -448,8 +444,7 @@ def visitor(
448444 acc_map , final_tree = accumulator
449445 node_dict : Dict [str , Any ] = {"__children" : []}
450446 line = []
451- for column_index in range (len (grid .columns )):
452- column = grid .columns [column_index ]
447+ for column_index , column in enumerate (grid .columns ):
453448 renderer = self ._type_renderers .get (
454449 column .type , self ._type_renderers ["default" ]
455450 )
0 commit comments