mirror of
https://github.com/AUTOMATIC1111/stable-diffusion-webui.git
synced 2025-01-20 21:30:09 +08:00
linter
This commit is contained in:
parent
50699ce112
commit
b63dda3f45
@ -11,7 +11,6 @@ import subprocess as sp
|
|||||||
from PIL import Image
|
from PIL import Image
|
||||||
|
|
||||||
from modules import call_queue, shared, ui_tempdir
|
from modules import call_queue, shared, ui_tempdir
|
||||||
from modules.infotext_utils import image_from_url_text
|
|
||||||
import modules.images
|
import modules.images
|
||||||
from modules.ui_components import ToolButton
|
from modules.ui_components import ToolButton
|
||||||
import modules.infotext_utils as parameters_copypaste
|
import modules.infotext_utils as parameters_copypaste
|
||||||
|
@ -14,30 +14,30 @@ from modules import shared
|
|||||||
Savedfile = namedtuple("Savedfile", ["name"])
|
Savedfile = namedtuple("Savedfile", ["name"])
|
||||||
|
|
||||||
|
|
||||||
def register_tmp_file(gradio, filename):
|
def register_tmp_file(gradio_app, filename):
|
||||||
if hasattr(gradio, 'temp_file_sets'): # gradio 3.15
|
if hasattr(gradio_app, 'temp_file_sets'): # gradio 3.15
|
||||||
if hasattr(gr.utils, 'abspath'): # gradio 4.19
|
if hasattr(gr.utils, 'abspath'): # gradio 4.19
|
||||||
filename = gr.utils.abspath(filename)
|
filename = gr.utils.abspath(filename)
|
||||||
else:
|
else:
|
||||||
filename = os.path.abspath(filename)
|
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
|
if hasattr(gradio_app, 'temp_dirs'): # gradio 3.9
|
||||||
gradio.temp_dirs = gradio.temp_dirs | {os.path.abspath(os.path.dirname(filename))}
|
gradio_app.temp_dirs = gradio_app.temp_dirs | {os.path.abspath(os.path.dirname(filename))}
|
||||||
|
|
||||||
|
|
||||||
def check_tmp_file(gradio, filename):
|
def check_tmp_file(gradio_app, filename):
|
||||||
if hasattr(gradio, 'temp_file_sets'):
|
if hasattr(gradio_app, 'temp_file_sets'):
|
||||||
if hasattr(gr.utils, 'abspath'): # gradio 4.19
|
if hasattr(gr.utils, 'abspath'): # gradio 4.19
|
||||||
filename = gr.utils.abspath(filename)
|
filename = gr.utils.abspath(filename)
|
||||||
else:
|
else:
|
||||||
filename = os.path.abspath(filename)
|
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'):
|
if hasattr(gradio_app, 'temp_dirs'):
|
||||||
return any(Path(temp_dir).resolve() in Path(filename).resolve().parents for temp_dir in gradio.temp_dirs)
|
return any(Path(temp_dir).resolve() in Path(filename).resolve().parents for temp_dir in gradio_app.temp_dirs)
|
||||||
|
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user