From fa95f843a3063d60a81fd1f64e0b6ef5217c937a Mon Sep 17 00:00:00 2001 From: Luciano Strika Date: Thu, 12 Jul 2018 21:57:05 -0300 Subject: [PATCH] correct my linting --- lib/beautifier.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/lib/beautifier.py b/lib/beautifier.py index 95403a5..011bc5f 100644 --- a/lib/beautifier.py +++ b/lib/beautifier.py @@ -162,16 +162,23 @@ def _unindent_code(line, shift=0): return line - - def _wrap_lines(lines_classes, unindent_code=False): """ Wrap classified lines. Add the split lines to the stream. If `unindent_code` is True, remove leading four spaces. """ + result = [] for line_type,line_content in lines_classes: - _format_line(line_type,line_content) + if line_type == CODE: + + shift = 3 if unindent_code else -1 + result.append((line_type, _unindent_code(line_content, shift=shift))) + else: + if line_content.strip() == "": + result.append((line_type, "")) + for line in textwrap.fill(line_content).splitlines(): + result.append((line_type, line)) return result