From b63dda3f45b369e93ec0c1b82d4b6d65bdd98a65 Mon Sep 17 00:00:00 2001 From: AUTOMATIC1111 <16777216c@gmail.com> Date: Sat, 2 Mar 2024 08:43:46 +0300 Subject: [PATCH] linter --- modules/ui_common.py | 1 - modules/ui_tempdir.py | 20 ++++++++++---------- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/modules/ui_common.py b/modules/ui_common.py index d03ce68a2..6d1928df8 100644 --- a/modules/ui_common.py +++ b/modules/ui_common.py @@ -11,7 +11,6 @@ import subprocess as sp from PIL import Image from modules import call_queue, shared, ui_tempdir -from modules.infotext_utils import image_from_url_text import modules.images from modules.ui_components import ToolButton import modules.infotext_utils as parameters_copypaste diff --git a/modules/ui_tempdir.py b/modules/ui_tempdir.py index a611cb012..3c401ec43 100644 --- a/modules/ui_tempdir.py +++ b/modules/ui_tempdir.py @@ -14,30 +14,30 @@ from modules import shared Savedfile = namedtuple("Savedfile", ["name"]) -def register_tmp_file(gradio, filename): - if hasattr(gradio, 'temp_file_sets'): # gradio 3.15 +def register_tmp_file(gradio_app, filename): + if hasattr(gradio_app, 'temp_file_sets'): # gradio 3.15 if hasattr(gr.utils, 'abspath'): # gradio 4.19 filename = gr.utils.abspath(filename) else: filename = os.path.abspath(filename) - gradio.temp_file_sets[0] = gradio.temp_file_sets[0] | {filename} + gradio_app.temp_file_sets[0] = gradio_app.temp_file_sets[0] | {filename} - if hasattr(gradio, 'temp_dirs'): # gradio 3.9 - gradio.temp_dirs = gradio.temp_dirs | {os.path.abspath(os.path.dirname(filename))} + if hasattr(gradio_app, 'temp_dirs'): # gradio 3.9 + gradio_app.temp_dirs = gradio_app.temp_dirs | {os.path.abspath(os.path.dirname(filename))} -def check_tmp_file(gradio, filename): - if hasattr(gradio, 'temp_file_sets'): +def check_tmp_file(gradio_app, filename): + if hasattr(gradio_app, 'temp_file_sets'): if hasattr(gr.utils, 'abspath'): # gradio 4.19 filename = gr.utils.abspath(filename) else: filename = os.path.abspath(filename) - return any(filename in fileset for fileset in gradio.temp_file_sets) + return any(filename in fileset for fileset in gradio_app.temp_file_sets) - if hasattr(gradio, 'temp_dirs'): - return any(Path(temp_dir).resolve() in Path(filename).resolve().parents for temp_dir in gradio.temp_dirs) + if hasattr(gradio_app, 'temp_dirs'): + return any(Path(temp_dir).resolve() in Path(filename).resolve().parents for temp_dir in gradio_app.temp_dirs) return False