Use Generator Expressions Instead of List Comprehensions

This commit is contained in:
pixeebot[bot] 2024-04-09 14:02:09 +00:00 committed by GitHub
parent fcd8254205
commit 752b619e2e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 4 additions and 4 deletions

View File

@ -92,7 +92,7 @@ def create_predictor(model_dir=None, model_lang="ch", is_onnx=False):
def _check_image_file(path): def _check_image_file(path):
img_end = {"jpg", "bmp", "png", "jpeg", "rgb", "tif", "tiff"} 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): def get_image_file_list(img_file):

View File

@ -274,7 +274,7 @@ class LDM(InpaintModel):
get_cache_path_by_url(LDM_DECODE_MODEL_URL), get_cache_path_by_url(LDM_DECODE_MODEL_URL),
get_cache_path_by_url(LDM_ENCODE_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() @torch.cuda.amp.autocast()
def forward(self, image, mask, config: InpaintRequest): def forward(self, image, mask, config: InpaintRequest):

View File

@ -54,7 +54,7 @@ class Manga(InpaintModel):
get_cache_path_by_url(MANGA_INPAINTOR_MODEL_URL), get_cache_path_by_url(MANGA_INPAINTOR_MODEL_URL),
get_cache_path_by_url(MANGA_LINE_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): def forward(self, image, mask, config: InpaintRequest):
""" """

View File

@ -269,7 +269,7 @@ class ZITS(InpaintModel):
get_cache_path_by_url(ZITS_STRUCTURE_UPSAMPLE_MODEL_URL), get_cache_path_by_url(ZITS_STRUCTURE_UPSAMPLE_MODEL_URL),
get_cache_path_by_url(ZITS_INPAINT_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): def wireframe_edge_and_line(self, items, enable: bool):
# 最终向 items 中添加 edge 和 line key # 最终向 items 中添加 edge 和 line key