File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -94,14 +94,14 @@ def _truncate_explanation(
9494 truncated_explanation = input_lines [:max_lines ]
9595 else :
9696 truncated_explanation = input_lines
97- truncated_char = True
9897 # We reevaluate the need to truncate chars following removal of some lines
99- if len ("" .join (truncated_explanation )) > tolerable_max_chars and max_chars > 0 :
98+ need_to_truncate_char = (
99+ max_chars > 0 and len ("" .join (truncated_explanation )) > tolerable_max_chars
100+ )
101+ if need_to_truncate_char :
100102 truncated_explanation = _truncate_by_char_count (
101103 truncated_explanation , max_chars
102104 )
103- else :
104- truncated_char = False
105105
106106 if truncated_explanation == input_lines :
107107 # No truncation happened, so we do not need to add any explanations
@@ -110,7 +110,7 @@ def _truncate_explanation(
110110 # Something was truncated, adding '...' at the end to show that
111111 truncated_explanation [- 1 ] += "..."
112112 truncated_line_count = (
113- len (input_lines ) - len (truncated_explanation ) + int (truncated_char )
113+ len (input_lines ) - len (truncated_explanation ) + int (need_to_truncate_char )
114114 )
115115 return [
116116 * truncated_explanation ,
You can’t perform that action at this time.
0 commit comments