Skip to content

Commit d35efd8

Browse files
committed
added check for isclass before checking for sub-classes
1 parent 5b338ce commit d35efd8

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

nipype2pydra/pkg_gen/__init__.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import shutil
88
import string
99
from pathlib import Path
10+
import inspect
1011
import attrs
1112
from warnings import warn
1213
import requests
@@ -481,9 +482,10 @@ def combine_types(type_, prev_type):
481482
if ty.get_origin(type_) is list:
482483
as_list = True
483484
type_ = ty.get_args(type_)[0]
484-
if issubclass(type_, prev_type):
485+
both_classes = inspect.isclass(type_) and inspect.isclass(prev_type)
486+
if both_classes and issubclass(type_, prev_type):
485487
combined = type_
486-
elif issubclass(prev_type, type_):
488+
elif both_classes and issubclass(prev_type, type_):
487489
combined = prev_type
488490
else:
489491
if ty.get_origin(prev_type) is ty.Union:

0 commit comments

Comments
 (0)