From 396adbce32e4011e21f281d701ad9e4bf98ed85c Mon Sep 17 00:00:00 2001 From: Will McGugan Date: Thu, 22 Oct 2020 21:54:45 +0100 Subject: [PATCH] mypy and formatting --- rich/text.py | 4 ++-- tests/test_text.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/rich/text.py b/rich/text.py index ee4ac0cf..353ccb0c 100644 --- a/rich/text.py +++ b/rich/text.py @@ -1060,7 +1060,7 @@ class Text(JupyterMixin): blank_lines = 0 for line in text.split(): match = re_indent.match(line.plain) - if not match.group(2): + if not match or not match.group(2): blank_lines += 1 continue indent = match.group(1) @@ -1096,4 +1096,4 @@ def __add__(self, other: Any) -> "Text": """ text = Text(code) text = text.with_indent_guides() - print(text) \ No newline at end of file + print(text) diff --git a/tests/test_text.py b/tests/test_text.py index 5cfc288a..2b0e1541 100644 --- a/tests/test_text.py +++ b/tests/test_text.py @@ -635,4 +635,4 @@ foo = [ print(result.plain) print(repr(result.plain)) expected = "for a in range(10):\n│ print(a)\n\nfoo = [\n│ 1,\n│ {\n│ │ 2\n│ }\n]\n" - assert result.plain == expected \ No newline at end of file + assert result.plain == expected