From 5aad932c7c616e4dbeeb31356bc1aebe71e66826 Mon Sep 17 00:00:00 2001 From: Sven Heidemann Date: Tue, 18 Jan 2022 18:13:43 +0100 Subject: [PATCH] Minor bugfixes to handle attributes --- src/py_to_uxf_core/service/attribute_scanner_service.py | 3 +++ src/py_to_uxf_core/service/python_parser_service.py | 6 ++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/py_to_uxf_core/service/attribute_scanner_service.py b/src/py_to_uxf_core/service/attribute_scanner_service.py index 38b8f3f..e6d640d 100644 --- a/src/py_to_uxf_core/service/attribute_scanner_service.py +++ b/src/py_to_uxf_core/service/attribute_scanner_service.py @@ -26,6 +26,9 @@ class AttributeScannerService(AttributeScannerABC): if name.startswith('self.'): name = name.split('self.')[1] + if ':' in name: + name = name.split(':')[0] + if '.' in name: return None diff --git a/src/py_to_uxf_core/service/python_parser_service.py b/src/py_to_uxf_core/service/python_parser_service.py index 1fd24bc..6ca671a 100644 --- a/src/py_to_uxf_core/service/python_parser_service.py +++ b/src/py_to_uxf_core/service/python_parser_service.py @@ -47,7 +47,7 @@ class PythonParserService(PythonParserABC): for i in range(len(lines)): try: line = lines[i] - line_with_tabs = line + line_with_tabs = line.replace(' ', '\t') line = line.replace(' ', '') line = line.replace('\t', '') # replace line break at the end of line @@ -55,8 +55,6 @@ class PythonParserService(PythonParserABC): line = line.replace('\n', '') if line == '\n' or line == '': - if is_function: - is_function = False continue # one line comments @@ -89,7 +87,7 @@ class PythonParserService(PythonParserABC): is_function = True if func.name != '__init__' else False continue - if len(line_with_tabs.split(' ')) > 3 or is_function: + if is_function: continue attribute = self._attribute_scanner.scan_line_for_attribute(line)