From 1addc89f83d6eab95b2ece765a1b08c9ce0d43c2 Mon Sep 17 00:00:00 2001 From: gregorni Date: Thu, 27 Jul 2023 15:57:03 +0200 Subject: [PATCH] formatter.py: Make constants uppercase Also mark a `print` used for testing for removal --- blueprintcompiler/formatter.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/blueprintcompiler/formatter.py b/blueprintcompiler/formatter.py index 9bc798c..5b87331 100644 --- a/blueprintcompiler/formatter.py +++ b/blueprintcompiler/formatter.py @@ -19,9 +19,9 @@ from . import tokenizer -newline_after = [";", "]"] -opening_tokens = ["{"] -closing_tokens = ["}"] +NEWLINE_AFTER = [";", "]"] +OPENING_TOKENS = ["{"] +CLOSING_TOKENS = ["}"] class Format: @@ -32,15 +32,15 @@ class Format: for index, item in enumerate(tokens): if item.type != tokenizer.TokenType.WHITESPACE: - if str(item) in opening_tokens: + if str(item) in OPENING_TOKENS: indent_levels += 1 - elif str(item) in closing_tokens: + elif str(item) in CLOSING_TOKENS: tokenized_str = tokenized_str[:-2] indent_levels -= 1 tokenized_str += str(item) - if str(item) in newline_after + closing_tokens + opening_tokens: + if str(item) in NEWLINE_AFTER + CLOSING_TOKENS + OPENING_TOKENS: tokenized_str += "\n" tokenized_str += indent_levels * " " @@ -48,6 +48,6 @@ class Format: if tokenized_str == tokenized_str.strip(): tokenized_str += " " - print(tokenized_str) + print(tokenized_str) # TODO: Remove this when the MR is ready to be merged return tokenized_str