From 752b619e2e7732f95c9ff30fd877c60d740e3e12 Mon Sep 17 00:00:00 2001 From: "pixeebot[bot]" <104101892+pixeebot[bot]@users.noreply.github.com> Date: Tue, 9 Apr 2024 14:02:09 +0000 Subject: [PATCH] Use Generator Expressions Instead of List Comprehensions --- iopaint/model/anytext/cldm/recognizer.py | 2 +- iopaint/model/ldm.py | 2 +- iopaint/model/manga.py | 2 +- iopaint/model/zits.py | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/iopaint/model/anytext/cldm/recognizer.py b/iopaint/model/anytext/cldm/recognizer.py index 0621512..35fe7cf 100755 --- a/iopaint/model/anytext/cldm/recognizer.py +++ b/iopaint/model/anytext/cldm/recognizer.py @@ -92,7 +92,7 @@ def create_predictor(model_dir=None, model_lang="ch", is_onnx=False): def _check_image_file(path): img_end = {"jpg", "bmp", "png", "jpeg", "rgb", "tif", "tiff"} - return any([path.lower().endswith(e) for e in img_end]) + return any(path.lower().endswith(e) for e in img_end) def get_image_file_list(img_file): diff --git a/iopaint/model/ldm.py b/iopaint/model/ldm.py index 19e51a3..561d719 100644 --- a/iopaint/model/ldm.py +++ b/iopaint/model/ldm.py @@ -274,7 +274,7 @@ class LDM(InpaintModel): get_cache_path_by_url(LDM_DECODE_MODEL_URL), get_cache_path_by_url(LDM_ENCODE_MODEL_URL), ] - return all([os.path.exists(it) for it in model_paths]) + return all(os.path.exists(it) for it in model_paths) @torch.cuda.amp.autocast() def forward(self, image, mask, config: InpaintRequest): diff --git a/iopaint/model/manga.py b/iopaint/model/manga.py index 1f58251..dc0bf77 100644 --- a/iopaint/model/manga.py +++ b/iopaint/model/manga.py @@ -54,7 +54,7 @@ class Manga(InpaintModel): get_cache_path_by_url(MANGA_INPAINTOR_MODEL_URL), get_cache_path_by_url(MANGA_LINE_MODEL_URL), ] - return all([os.path.exists(it) for it in model_paths]) + return all(os.path.exists(it) for it in model_paths) def forward(self, image, mask, config: InpaintRequest): """ diff --git a/iopaint/model/zits.py b/iopaint/model/zits.py index d58ac01..21fe79e 100644 --- a/iopaint/model/zits.py +++ b/iopaint/model/zits.py @@ -269,7 +269,7 @@ class ZITS(InpaintModel): get_cache_path_by_url(ZITS_STRUCTURE_UPSAMPLE_MODEL_URL), get_cache_path_by_url(ZITS_INPAINT_MODEL_URL), ] - return all([os.path.exists(it) for it in model_paths]) + return all(os.path.exists(it) for it in model_paths) def wireframe_edge_and_line(self, items, enable: bool): # 最终向 items 中添加 edge 和 line key