diff options
author | Aarni Koskela <akx@iki.fi> | 2023-06-02 11:58:10 +0000 |
---|---|---|
committer | Aarni Koskela <akx@iki.fi> | 2023-06-02 12:07:10 +0000 |
commit | 51864790fd72386fbbbb015d24a43ce501ecaa4b (patch) | |
tree | a114dc065c25ec267043f35dea735f8e3097e9a0 /modules/images.py | |
parent | 3e995778fc525ff15d56c1472c1a1bc701019ec5 (diff) | |
download | stable-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/images.py')
-rw-r--r-- | modules/images.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/modules/images.py b/modules/images.py index a12d252b..7bbfc3e0 100644 --- a/modules/images.py +++ b/modules/images.py @@ -406,7 +406,7 @@ class FilenameGenerator: prompt_no_style = self.prompt
for style in shared.prompt_styles.get_style_prompts(self.p.styles):
- if len(style) > 0:
+ if style:
for part in style.split("{prompt}"):
prompt_no_style = prompt_no_style.replace(part, "").replace(", ,", ",").strip().strip(',')
@@ -415,7 +415,7 @@ class FilenameGenerator: return sanitize_filename_part(prompt_no_style, replace_spaces=False)
def prompt_words(self):
- words = [x for x in re_nonletters.split(self.prompt or "") if len(x) > 0]
+ words = [x for x in re_nonletters.split(self.prompt or "") if x]
if len(words) == 0:
words = ["empty"]
return sanitize_filename_part(" ".join(words[0:opts.directories_max_prompt_words]), replace_spaces=False)
@@ -423,7 +423,7 @@ class FilenameGenerator: def datetime(self, *args):
time_datetime = datetime.datetime.now()
- time_format = args[0] if len(args) > 0 and args[0] != "" else self.default_time_format
+ time_format = args[0] if (args and args[0] != "") else self.default_time_format
try:
time_zone = pytz.timezone(args[1]) if len(args) > 1 else None
except pytz.exceptions.UnknownTimeZoneError:
|