mirror of
				https://github.com/ARM-software/workload-automation.git
				synced 2025-10-31 15:12:25 +00:00 
			
		
		
		
	utils/misc: fix write_table column widths
Consider headers when calculating column widths. This will ensure proper alignment in cases where the column header is wider than any of the column values.
This commit is contained in:
		
				
					committed by
					
						 Marc Bonnici
						Marc Bonnici
					
				
			
			
				
	
			
			
			
						parent
						
							a3b1921793
						
					
				
				
					commit
					06d351f054
				
			| @@ -110,6 +110,8 @@ def write_table(rows, wfh, align='>', headers=None):  # pylint: disable=R0914 | |||||||
|  |  | ||||||
|     cols = list(zip(*rows)) |     cols = list(zip(*rows)) | ||||||
|     col_widths = [max(list(map(len, c))) for c in cols] |     col_widths = [max(list(map(len, c))) for c in cols] | ||||||
|  |     if headers: | ||||||
|  |         col_widths = [max([c, len(h)]) for c, h in zip(col_widths, headers)] | ||||||
|     row_format = ' '.join(['{:%s%s}' % (align[i], w) for i, w in enumerate(col_widths)]) |     row_format = ' '.join(['{:%s%s}' % (align[i], w) for i, w in enumerate(col_widths)]) | ||||||
|     row_format += '\n' |     row_format += '\n' | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user