(text, max_line_width)
| 18005 | # Helper function for determining how to wrap text # |
| 18006 | # ===================================================# |
| 18007 | def _GetNumLinesNeeded(text, max_line_width): |
| 18008 | if max_line_width == 0: |
| 18009 | return 1 |
| 18010 | lines = text.split('\n') |
| 18011 | num_lines = len(lines) # number of original lines of text |
| 18012 | max_line_len = max([len(l) for l in lines]) # longest line |
| 18013 | lines_used = [] |
| 18014 | for L in lines: |
| 18015 | lines_used.append(len(L) // max_line_width + (len(L) % max_line_width > 0)) # fancy math to round up |
| 18016 | total_lines_needed = sum(lines_used) |
| 18017 | return total_lines_needed |
| 18018 | |
| 18019 | |
| 18020 | # ============================== PROGRESS METER ========================================== # |
no outgoing calls
no test coverage detected