Skip to content

Commit 17d8b93

Browse files
Bugfix
1 parent ddae807 commit 17d8b93

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

hwcomponents/find_models.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,9 @@ def get_models(
149149
i += 1
150150
if isinstance(path_or_package, (list, tuple)):
151151
to_check.extend(path_or_package)
152-
elif issubclass(path_or_package, ComponentModel):
152+
elif isinstance(path_or_package, type) and issubclass(
153+
path_or_package, ComponentModel
154+
):
153155
models.append(path_or_package)
154156
elif isinstance(path_or_package, (str, Path)):
155157
globbed = glob.glob(path_or_package, recursive=True)
@@ -209,7 +211,8 @@ def get_models(
209211
paths_globbed.extend(newpaths)
210212
if not newpaths:
211213
raise ValueError(
212-
f"Path {p} does not have any Python files. Please check the path and try again."
214+
f"Path {p} does not have any Python files. Please check the path and "
215+
f"try again."
213216
)
214217

215218
newpaths = [p.rstrip("/") for p in newpaths]
@@ -228,7 +231,7 @@ def get_models(
228231
sys.path.append(os.path.dirname(os.path.abspath(path)))
229232
python_module = SourceFileLoader(f"model{n_models}", path).load_module()
230233
new_models += get_models_in_module(
231-
python_module, model_ids, name_must_include, _return_wrappers
234+
python_module, model_ids, _return_wrappers
232235
)
233236
sys.path = prev_sys_path
234237
n_models += 1

0 commit comments

Comments
 (0)