diff --git a/src/python/jw/util/misc.py b/src/python/jw/util/misc.py index 7c4959a..0485613 100644 --- a/src/python/jw/util/misc.py +++ b/src/python/jw/util/misc.py @@ -96,13 +96,15 @@ def load_classes( # export return ret def load_class( # export - module_path: str, + module_path: str | Iterable[str], baseclass: type, class_name_filter: str | None = None ) -> type[Any]: + if isinstance(module_path, str): + module_path = [module_path] type_filter = None if baseclass is None else [baseclass] classes: Iterable[type[Any]] = LoadTypes( - [module_path], type_name_filter = class_name_filter, type_filter = type_filter + module_path, type_name_filter = class_name_filter, type_filter = type_filter ).classes size = len(list(classes)) if size != 1: @@ -111,7 +113,7 @@ def load_class( # export msg += f' matching "{class_name_filter}' if baseclass is not None: msg += f' of type "{baseclass}" ' - msg += f'found in module "{module_path}"' + msg += f'found in modules {", ".join(module_path)}' for c in classes: log.slog(log.ERR, f'Found {c!r}') raise Exception(msg) @@ -136,7 +138,7 @@ def load_class_names( # export return ret def load_object( # export - module_path: str, + module_path: str | Iterable[str], baseclass: type, class_name_filter: str|None = None, *args,