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/ui_extensions.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/ui_extensions.py')
-rw-r--r-- | modules/ui_extensions.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/modules/ui_extensions.py b/modules/ui_extensions.py index 5580dfaf..1ae516d7 100644 --- a/modules/ui_extensions.py +++ b/modules/ui_extensions.py @@ -333,7 +333,8 @@ def install_extension_from_url(dirname, url, branch_name=None): assert not os.path.exists(target_dir), f'Extension directory already exists: {target_dir}'
normalized_url = normalize_git_url(url)
- assert len([x for x in extensions.extensions if normalize_git_url(x.remote) == normalized_url]) == 0, 'Extension with this URL is already installed'
+ if any(x for x in extensions.extensions if normalize_git_url(x.remote) == normalized_url):
+ raise Exception(f'Extension with this URL is already installed: {url}')
tmpdir = os.path.join(paths.data_path, "tmp", dirname)
@@ -449,7 +450,7 @@ def refresh_available_extensions_from_data(hide_tags, sort_column, filter_text=" existing = installed_extension_urls.get(normalize_git_url(url), None)
extension_tags = extension_tags + ["installed"] if existing else extension_tags
- if len([x for x in extension_tags if x in tags_to_hide]) > 0:
+ if any(x for x in extension_tags if x in tags_to_hide):
hidden += 1
continue
|