File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -80,18 +80,14 @@ def _truncate_explanation(
8080 tolerable_max_chars = (
8181 max_chars + 70 # 64 + 1 (for plural) + 2 (for '99') + 3 for '...'
8282 )
83- if (
84- # The truncation explanation add two lines to the output
85- max_lines == 0 or len (input_lines ) <= max_lines + 2
86- ) and (
87- max_chars == 0 or sum (len (line ) for line in input_lines ) <= tolerable_max_chars
88- ):
89- return input_lines
90- # Truncate first to max_lines, and then truncate to max_chars if necessary
91- if max_lines > 0 :
92- truncated_explanation = input_lines [:max_lines ]
93- else :
83+ # The truncation explanation add two lines to the output
84+ if max_lines == 0 or len (input_lines ) <= max_lines + 2 :
85+ if max_chars == 0 or sum (len (s ) for s in input_lines ) <= tolerable_max_chars :
86+ return input_lines
9487 truncated_explanation = input_lines
88+ else :
89+ # Truncate first to max_lines, and then truncate to max_chars if necessary
90+ truncated_explanation = input_lines [:max_lines ]
9591 # We reevaluate the need to truncate chars following removal of some lines
9692 need_to_truncate_char = (
9793 max_chars > 0
You can’t perform that action at this time.
0 commit comments