aboutsummaryrefslogtreecommitdiffstats
path: root/modules/prompt_parser.py
diff options
context:
space:
mode:
authorAarni Koskela <akx@iki.fi>2023-06-02 11:58:10 +0000
committerAarni Koskela <akx@iki.fi>2023-06-02 12:07:10 +0000
commit51864790fd72386fbbbb015d24a43ce501ecaa4b (patch)
treea114dc065c25ec267043f35dea735f8e3097e9a0 /modules/prompt_parser.py
parent3e995778fc525ff15d56c1472c1a1bc701019ec5 (diff)
downloadstable-diffusion-webui-gfx803-51864790fd72386fbbbb015d24a43ce501ecaa4b.tar.gz
stable-diffusion-webui-gfx803-51864790fd72386fbbbb015d24a43ce501ecaa4b.tar.bz2
stable-diffusion-webui-gfx803-51864790fd72386fbbbb015d24a43ce501ecaa4b.zip
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)