🐛 Allow Script to have metaclass

This commit is contained in:
huchenlei 2023-06-16 15:17:17 -04:00
parent baf6946e06
commit 373ff5a217

View File

@ -2,6 +2,7 @@ import os
import re import re
import sys import sys
import traceback import traceback
import inspect
from collections import namedtuple from collections import namedtuple
import gradio as gr import gradio as gr
@ -238,7 +239,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):