@@ -59,9 +59,9 @@ def __init__(self, ticks_per_refresh=1, produce_diffs=True):
5959 self .ncurses_custom_fields = dict .fromkeys (StatCollector .NCURSES_CUSTOM_OUTPUT_FIELDS , None )
6060
6161 def postinit (self ):
62- for l in [self .transform_list_data , self .transform_dict_data , self .diff_generator_data ,
62+ for n in [self .transform_list_data , self .transform_dict_data , self .diff_generator_data ,
6363 self .output_transform_data ]:
64- self .validate_list_out (l )
64+ self .validate_list_out (n )
6565 self .output_column_positions = self ._calculate_output_column_positions ()
6666
6767 def set_ignore_autohide (self , new_status ):
@@ -91,12 +91,12 @@ def exec_command_with_output(cmdline):
9191 return ret , proc .stdout .read ().strip ()
9292
9393 @staticmethod
94- def validate_list_out (l ):
94+ def validate_list_out (n ):
9595 """ If the list element doesn't supply an out column - remove it """
9696
97- for col in l :
97+ for col in n :
9898 if 'out' not in col :
99- el = l .pop (l .index (col ))
99+ el = n .pop (n .index (col ))
100100 logger .error ('Removed {0} column because it did not specify out value' .format (el ))
101101
102102 @staticmethod
@@ -135,10 +135,10 @@ def kb_pretty_print_long(b):
135135 """ Show kb values in a human readable form. """
136136
137137 r = []
138- for l , n in StatCollector .BYTE_MAP :
138+ for unit , n in StatCollector .BYTE_MAP :
139139 d = b / n
140140 if d :
141- r .append (str (d ) + l )
141+ r .append (str (d ) + unit )
142142 b %= n
143143 return ' ' .join (r )
144144
@@ -147,10 +147,10 @@ def kb_pretty_print(b):
147147 """ Show memory size as a float value in the biggest measurement units """
148148
149149 r = []
150- for l , n in StatCollector .BYTE_MAP :
150+ for unit , n in StatCollector .BYTE_MAP :
151151 if b > n :
152152 v = round (float (b ) / n , 1 )
153- r .append (str (v ) + l )
153+ r .append (str (v ) + unit )
154154 break
155155 if len (r ) == 0 :
156156 return '{0}KB' .format (str (b ))
@@ -486,21 +486,21 @@ def _transform_input(self, x, custom_transformation_data=None):
486486 # behavior in case 'in' is not specified: the _dict version assumes the in
487487 # column is the same as the out one, the list emits the warning and skips
488488 # the column.
489- def _transform_list (self , l , custom_transformation_data = None ):
489+ def _transform_list (self , x , custom_transformation_data = None ):
490490 result = {}
491491 # choose between the 'embedded' and external transformations
492492 if custom_transformation_data is not None :
493493 transformation_data = custom_transformation_data
494494 else :
495495 transformation_data = self .transform_list_data
496496 if transformation_data is not None :
497- total = len (l )
497+ total = len (x )
498498 for col in transformation_data :
499499 # set the output column name
500500 attname = col ['out' ]
501501 if 'infn' in col :
502- if len (l ) > 0 :
503- result [attname ] = col ['infn' ](attname , l , 'optional' in col and col ['optional' ])
502+ if len (x ) > 0 :
503+ result [attname ] = col ['infn' ](attname , x , 'optional' in col and col ['optional' ])
504504 else :
505505 result [attname ] = None
506506 else :
@@ -513,18 +513,18 @@ def _transform_list(self, l, custom_transformation_data=None):
513513 # the result in the format we ask them to, but, on the other hand, if there is
514514 # nothing at all from them - then the problem is elsewhere and there is no need
515515 # to bleat here for each missing column.
516- if not col .get ('optional' , False ) and len (l ) > 0 :
516+ if not col .get ('optional' , False ) and len (x ) > 0 :
517517 self .warn_non_optional_column (incol )
518518 else :
519- result [attname ] = l [incol ]
519+ result [attname ] = x [incol ]
520520 # if transformation function is supplied - apply it to the input data.
521521 if 'fn' in col and result [attname ] is not None :
522522 result [attname ] = col ['fn' ](result [attname ])
523523 return result
524524 raise Exception ('No data for the list transformation supplied' )
525525
526526 # Most of the functionality is the same as in the dict transforming function above.
527- def _transform_dict (self , l , custom_transformation_data = None ):
527+ def _transform_dict (self , x , custom_transformation_data = None ):
528528 result = {}
529529 if custom_transformation_data is not None :
530530 transformation_data = custom_transformation_data
@@ -538,19 +538,19 @@ def _transform_dict(self, l, custom_transformation_data=None):
538538 # if infn is supplied - it calculates the column value possbily using other values
539539 # in the row - we don't use incoming column in this case.
540540 if 'infn' in col :
541- if len (l ) > 0 :
542- result [attname ] = col ['infn' ](attname , l , 'optional' in col and col ['optional' ])
541+ if len (x ) > 0 :
542+ result [attname ] = col ['infn' ](attname , x , 'optional' in col and col ['optional' ])
543543 else :
544544 result [attname ] = None
545- elif incol not in l :
545+ elif incol not in x :
546546 # if the column is marked as optional and it's not present in the output data
547547 # set None instead
548548 result [attname ] = None
549549 # see the comment at _transform_list on why we do complain here.
550- if not col .get ('optional' , False ) and len (l ) > 0 :
550+ if not col .get ('optional' , False ) and len (x ) > 0 :
551551 self .warn_non_optional_column (incol )
552552 else :
553- result [attname ] = l [incol ]
553+ result [attname ] = x [incol ]
554554 if 'fn' in col and result [attname ] is not None :
555555 result [attname ] = col ['fn' ](result [attname ])
556556 return result
0 commit comments