Added support for multiple subclasses
This commit is contained in:
parent
1eb7aa37d3
commit
f41e31371f
@ -28,3 +28,9 @@ class PythonClass:
|
|||||||
|
|
||||||
def add_attribute(self, attribute: PythonClassAttribute):
|
def add_attribute(self, attribute: PythonClassAttribute):
|
||||||
self._attributes.append(attribute)
|
self._attributes.append(attribute)
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
return f'{self._name}'
|
||||||
|
|
||||||
|
def __repr__(self):
|
||||||
|
return f'{self._name}'
|
||||||
|
@ -33,21 +33,27 @@ class ImplementationScannerService(ImplementationScannerABC):
|
|||||||
line = line.replace('\t', '')
|
line = line.replace('\t', '')
|
||||||
if line.startswith('class ') and '(' in line and ')' in line:
|
if line.startswith('class ') and '(' in line and ')' in line:
|
||||||
sub_name = line.split('class ')[1].split('(')[0]
|
sub_name = line.split('class ')[1].split('(')[0]
|
||||||
sub: Optional[PythonClass] = classes.where(lambda c: c.name == sub_name).first_or_default()
|
subclasses = classes.where(lambda c: c.name == sub_name)
|
||||||
if sub is None:
|
implementations = List(ClassImplementation)
|
||||||
return None
|
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 ',' in base_name:
|
||||||
implementations = List(ClassImplementation)
|
for name in base_name.split(','):
|
||||||
for name in base_name.split(','):
|
if '=' in name:
|
||||||
if '=' in name:
|
continue
|
||||||
continue
|
|
||||||
|
|
||||||
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 implementations
|
||||||
return self._get_implementation(base_name, sub, classes)
|
# 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 None
|
return None
|
||||||
|
Loading…
Reference in New Issue
Block a user