correct indent

This commit is contained in:
DepFA 2022-10-02 19:26:06 +01:00 committed by GitHub
parent 2deea86781
commit e808096cf6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 36 additions and 35 deletions

View file

@ -163,7 +163,7 @@ class ScriptRunner:
return processed return processed
def reload_sources(self): def reload_sources(self):
for si,script in list(enumerate(self.scripts)): for si, script in list(enumerate(self.scripts)):
with open(script.filename, "r", encoding="utf8") as file: with open(script.filename, "r", encoding="utf8") as file:
args_from = script.args_from args_from = script.args_from
args_to = script.args_to args_to = script.args_to
@ -171,6 +171,7 @@ class ScriptRunner:
text = file.read() text = file.read()
from types import ModuleType from types import ModuleType
compiled = compile(text, filename, 'exec') compiled = compile(text, filename, 'exec')
module = ModuleType(script.filename) module = ModuleType(script.filename)
exec(compiled, module.__dict__) exec(compiled, module.__dict__)
@ -189,8 +190,9 @@ def reload_script_body_only():
scripts_txt2img.reload_sources() scripts_txt2img.reload_sources()
scripts_img2img.reload_sources() scripts_img2img.reload_sources()
def reload_scripts(basedir): def reload_scripts(basedir):
global scripts_txt2img,scripts_img2img global scripts_txt2img, scripts_img2img
scripts_data.clear() scripts_data.clear()
load_scripts(basedir) load_scripts(basedir)

View file

@ -1242,4 +1242,3 @@ if 'gradio_routes_templates_response' not in globals():
gradio_routes_templates_response = gradio.routes.templates.TemplateResponse gradio_routes_templates_response = gradio.routes.templates.TemplateResponse
gradio.routes.templates.TemplateResponse = template_response gradio.routes.templates.TemplateResponse = template_response