Merge pull request #11264 from huchenlei/meta_class

🐛 Allow Script to have custom metaclass
This commit is contained in:
AUTOMATIC1111 2023-06-27 09:02:51 +03:00 committed by GitHub
commit bedcd2f377
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,6 +1,7 @@
import os import os
import re import re
import sys import sys
import inspect
from collections import namedtuple from collections import namedtuple
import gradio as gr import gradio as gr
@ -249,7 +250,7 @@ def load_scripts():
def register_scripts_from_module(module): def register_scripts_from_module(module):
for script_class in module.__dict__.values(): for script_class in module.__dict__.values():
if type(script_class) != type: if not inspect.isclass(script_class):
continue continue
if issubclass(script_class, Script): if issubclass(script_class, Script):