Minor bugfixes to handle attributes

This commit is contained in:
Sven Heidemann 2022-01-18 18:13:43 +01:00
parent f7b88fe127
commit 5aad932c7c
2 changed files with 5 additions and 4 deletions

View File

@ -26,6 +26,9 @@ class AttributeScannerService(AttributeScannerABC):
if name.startswith('self.'): if name.startswith('self.'):
name = name.split('self.')[1] name = name.split('self.')[1]
if ':' in name:
name = name.split(':')[0]
if '.' in name: if '.' in name:
return None return None

View File

@ -47,7 +47,7 @@ class PythonParserService(PythonParserABC):
for i in range(len(lines)): for i in range(len(lines)):
try: try:
line = lines[i] line = lines[i]
line_with_tabs = line line_with_tabs = line.replace(' ', '\t')
line = line.replace(' ', '') line = line.replace(' ', '')
line = line.replace('\t', '') line = line.replace('\t', '')
# replace line break at the end of line # replace line break at the end of line
@ -55,8 +55,6 @@ class PythonParserService(PythonParserABC):
line = line.replace('\n', '') line = line.replace('\n', '')
if line == '\n' or line == '': if line == '\n' or line == '':
if is_function:
is_function = False
continue continue
# one line comments # one line comments
@ -89,7 +87,7 @@ class PythonParserService(PythonParserABC):
is_function = True if func.name != '__init__' else False is_function = True if func.name != '__init__' else False
continue continue
if len(line_with_tabs.split(' ')) > 3 or is_function: if is_function:
continue continue
attribute = self._attribute_scanner.scan_line_for_attribute(line) attribute = self._attribute_scanner.scan_line_for_attribute(line)