aboutsummaryrefslogtreecommitdiff
path: root/modules/prompt_parser.py
diff options
context:
space:
mode:
authorAUTOMATIC1111 <16777216c@gmail.com>2023-06-05 11:06:37 +0300
committerGitHub <noreply@github.com>2023-06-05 11:06:37 +0300
commit7a7a201d819ea9920a1f067c556ec3998911f01a (patch)
tree5a834df58178642477e0ab8bd0ab0a53e66f153a /modules/prompt_parser.py
parent9781f31f74c1f6acf8e1260f076aeb7a71e2766f (diff)
parent51864790fd72386fbbbb015d24a43ce501ecaa4b (diff)
Merge pull request #10956 from akx/len
Simplify a bunch of `len(x) > 0`/`len(x) == 0` style expressions
Diffstat (limited to 'modules/prompt_parser.py')
-rw-r--r--modules/prompt_parser.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/modules/prompt_parser.py b/modules/prompt_parser.py
index b4aff704..0069d8b0 100644
--- a/modules/prompt_parser.py
+++ b/modules/prompt_parser.py
@@ -336,11 +336,11 @@ def parse_prompt_attention(text):
round_brackets.append(len(res))
elif text == '[':
square_brackets.append(len(res))
- elif weight is not None and len(round_brackets) > 0:
+ elif weight is not None and round_brackets:
multiply_range(round_brackets.pop(), float(weight))
- elif text == ')' and len(round_brackets) > 0:
+ elif text == ')' and round_brackets:
multiply_range(round_brackets.pop(), round_bracket_multiplier)
- elif text == ']' and len(square_brackets) > 0:
+ elif text == ']' and square_brackets:
multiply_range(square_brackets.pop(), square_bracket_multiplier)
else:
parts = re.split(re_break, text)