fix: make class part of base_classes
This commit is contained in:
parent
44980c2220
commit
fb170aea66
1 changed files with 12 additions and 6 deletions
|
|
@ -158,17 +158,23 @@ def get_base_classes(cls):
|
||||||
"""Get the base classes of a class.
|
"""Get the base classes of a class.
|
||||||
These are used to determine the output of the nodes.
|
These are used to determine the output of the nodes.
|
||||||
"""
|
"""
|
||||||
bases = cls.__bases__
|
if bases := cls.__bases__:
|
||||||
if not bases:
|
|
||||||
return []
|
|
||||||
else:
|
|
||||||
result = []
|
result = []
|
||||||
for base in bases:
|
for base in bases:
|
||||||
if any(type in base.__module__ for type in ["pydantic", "abc"]):
|
if any(type in base.__module__ for type in ["pydantic", "abc"]):
|
||||||
continue
|
continue
|
||||||
result.append(base.__name__)
|
result.append(base.__name__)
|
||||||
result.extend(get_base_classes(base))
|
base_classes = get_base_classes(base)
|
||||||
return result
|
# check if the base_classes are in the result
|
||||||
|
# if not, add them
|
||||||
|
for base_class in base_classes:
|
||||||
|
if base_class not in result:
|
||||||
|
result.append(base_class)
|
||||||
|
else:
|
||||||
|
result = [cls.__name__]
|
||||||
|
if not result:
|
||||||
|
result = [cls.__name__]
|
||||||
|
return list(set(result))
|
||||||
|
|
||||||
|
|
||||||
def get_default_factory(module: str, function: str):
|
def get_default_factory(module: str, function: str):
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue