Skip to content

Commit b073803

Browse files
committed
Preventing indentation error on empty for loops, if statements etc.
1 parent 466a83b commit b073803

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

adafruit_templateengine.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -407,10 +407,12 @@ def _create_template_function( # pylint: disable=,too-many-locals,too-many-bran
407407
if last_token_was_block and text_before_token.startswith("\n"):
408408
text_before_token = text_before_token[1:]
409409

410-
if text_before_token:
411-
function_string += (
412-
indent * indentation_level + f"yield {repr(text_before_token)}\n"
413-
)
410+
if text_before_token:
411+
function_string += (
412+
indent * indentation_level + f"yield {repr(text_before_token)}\n"
413+
)
414+
else:
415+
function_string += indent * indentation_level + "pass\n"
414416

415417
# Token is an expression
416418
if token.startswith(r"{{ "):

0 commit comments

Comments
 (0)