Fixed handling of multiple base classes

This commit is contained in:
Sven Heidemann 2022-01-18 19:19:01 +01:00
parent f41e31371f
commit e5b3e80378

View File

@ -36,13 +36,14 @@ class ImplementationScannerService(ImplementationScannerABC):
subclasses = classes.where(lambda c: c.name == sub_name) subclasses = classes.where(lambda c: c.name == sub_name)
implementations = List(ClassImplementation) implementations = List(ClassImplementation)
for sub in subclasses: for sub in subclasses:
# sub: Optional[PythonClass] = classes.where(lambda c: c.name == sub_name).first_or_default()
# if sub is None:
# return None
line = line.replace(' ', '') line = line.replace(' ', '')
base_name = line.split('(')[1].split(')')[0] base_name = line.split('(')[1].split(')')[0]
if ',' in base_name: if ',' not in base_name:
implementation = self._get_implementation(base_name, sub, classes)
if implementation is not None:
implementations.append(implementation)
continue
for name in base_name.split(','): for name in base_name.split(','):
if '=' in name: if '=' in name:
continue continue
@ -50,10 +51,5 @@ class ImplementationScannerService(ImplementationScannerABC):
implementation = self._get_implementation(name, sub, classes) implementation = self._get_implementation(name, sub, classes)
if implementation is not None: if implementation is not None:
implementations.append(implementation) implementations.append(implementation)
# return implementations
# return self._get_implementation(base_name, sub, classes)
implementation = self._get_implementation(base_name, sub, classes)
if implementation is not None:
implementations.append(implementation)
return implementations return implementations
return None return None