diff options
author | AUTOMATIC1111 <16777216c@gmail.com> | 2023-06-05 08:06:37 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-06-05 08:06:37 +0000 |
commit | 7a7a201d819ea9920a1f067c556ec3998911f01a (patch) | |
tree | 5a834df58178642477e0ab8bd0ab0a53e66f153a /modules/generation_parameters_copypaste.py | |
parent | 9781f31f74c1f6acf8e1260f076aeb7a71e2766f (diff) | |
parent | 51864790fd72386fbbbb015d24a43ce501ecaa4b (diff) | |
download | stable-diffusion-webui-gfx803-7a7a201d819ea9920a1f067c556ec3998911f01a.tar.gz stable-diffusion-webui-gfx803-7a7a201d819ea9920a1f067c556ec3998911f01a.tar.bz2 stable-diffusion-webui-gfx803-7a7a201d819ea9920a1f067c556ec3998911f01a.zip |
Merge pull request #10956 from akx/len
Simplify a bunch of `len(x) > 0`/`len(x) == 0` style expressions
Diffstat (limited to 'modules/generation_parameters_copypaste.py')
-rw-r--r-- | modules/generation_parameters_copypaste.py | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/modules/generation_parameters_copypaste.py b/modules/generation_parameters_copypaste.py index 4c420e5f..1d02ffae 100644 --- a/modules/generation_parameters_copypaste.py +++ b/modules/generation_parameters_copypaste.py @@ -55,7 +55,7 @@ def image_from_url_text(filedata): if filedata is None:
return None
- if type(filedata) == list and len(filedata) > 0 and type(filedata[0]) == dict and filedata[0].get("is_file", False):
+ if type(filedata) == list and filedata and type(filedata[0]) == dict and filedata[0].get("is_file", False):
filedata = filedata[0]
if type(filedata) == dict and filedata.get("is_file", False):
@@ -445,7 +445,7 @@ def connect_paste(button, paste_fields, input_comp, override_settings_component, vals_pairs = [f"{k}: {v}" for k, v in vals.items()]
- return gr.Dropdown.update(value=vals_pairs, choices=vals_pairs, visible=len(vals_pairs) > 0)
+ return gr.Dropdown.update(value=vals_pairs, choices=vals_pairs, visible=bool(vals_pairs))
paste_fields = paste_fields + [(override_settings_component, paste_settings)]
@@ -462,5 +462,3 @@ def connect_paste(button, paste_fields, input_comp, override_settings_component, outputs=[],
show_progress=False,
)
-
-
|