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,24 +36,20 @@ 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:
for name in base_name.split(','): implementation = self._get_implementation(base_name, sub, classes)
if '=' in name: if implementation is not None:
continue implementations.append(implementation)
continue
implementation = self._get_implementation(name, sub, classes) for name in base_name.split(','):
if implementation is not None: if '=' in name:
implementations.append(implementation) continue
# return implementations
# return self._get_implementation(base_name, sub, classes) implementation = self._get_implementation(name, sub, classes)
implementation = self._get_implementation(base_name, sub, classes) if implementation is not None:
if implementation is not None: implementations.append(implementation)
implementations.append(implementation)
return implementations return implementations
return None return None