minor form changes

This commit is contained in:
Robin Müller 2021-06-21 12:52:01 +02:00
parent 798efe2048
commit 75969c45ee
No known key found for this signature in database
GPG Key ID: FC76078F520434A5
1 changed files with 23 additions and 10 deletions

View File

@ -27,9 +27,10 @@ class InterfaceParser(FileParser):
self.start_name_list = []
self.end_name_list = []
def _handle_file_parsing_moving_window(self, file_name: str, current_line: int,
moving_window_size: int, moving_window: list, *args,
**kwargs):
def _handle_file_parsing_moving_window(
self, file_name: str, current_line: int, moving_window_size: int, moving_window: list,
*args, **kwargs
):
pass
def _handle_file_parsing(self, file_name: str, *args, **kwargs):
@ -61,7 +62,7 @@ class InterfaceParser(FileParser):
match = re.search(r'[\s]*([\w]*),?(?:[\s]*//)?([^\n]*)?', line)
if match:
count += 1
if re.search(r"\[EXPORT\][\s]*:[\s]*\[END\]", match.group(2)):
if re.search(r"\[EXPORT][\s]*:[\s]*\[END]", match.group(2)):
last_entry_name = match.group(1)
end_matched = True
self.end_name_list.append([last_entry_name, None])
@ -75,7 +76,10 @@ class InterfaceParser(FileParser):
print(f"Current file: {file_name} | Make sure to include a start definition")
sys.exit(1)
if not end_matched:
print("No end match detected when parsing interface files. Make sure to use [EXPORT] : [END]")
print(
"No end match detected when parsing interface files. "
"Make sure to use [EXPORT] : [END]"
)
sys.exit(1)
self.start_name_list.append([start_name, target_end_name, None, count])
self.file_name_table.append(file_name)
@ -116,7 +120,10 @@ class InterfaceParser(FileParser):
all_indexes_filled = False
current_iteration += 1
if current_iteration >= max_outer_iterations:
print("Could not fill out start and end index list in given number of maximum outer iterations!")
print(
"Could not fill out start and end index list in "
"given number of maximum outer iterations!"
)
sys.exit(1)
return start_list_list_completed, end_list_list_completed
@ -124,7 +131,8 @@ class InterfaceParser(FileParser):
dict_to_build = dict()
for local_count, interface_name_and_shortname in interface_dict.items():
dict_to_build.update(
{interface_name_and_shortname[0]: [local_count + count_start, interface_name_and_shortname[1]]}
{interface_name_and_shortname[0]: [local_count + count_start,
interface_name_and_shortname[1]]}
)
self.mib_table.update(dict_to_build)
@ -240,7 +248,10 @@ class ReturnValueParser(FileParser):
two_lines
)
if returnvalue_match:
self.__handle_returnvalue_match(returnvalue_match, file_name, print_truncated_entries)
self.__handle_returnvalue_match(
name_match=returnvalue_match.group(1), file_name=file_name, description="",
number_match=returnvalue_match.group(2)
)
self.last_lines[1] = self.last_lines[0]
self.last_lines[0] = newline
@ -263,13 +274,15 @@ class ReturnValueParser(FileParser):
self.current_interface_id_entries["Name"], name_match, MAX_STRING_LEN,
PRINT_TRUNCATED_ENTRIES
)
full_id = (self.current_interface_id_entries["ID"] << 8) + return_number_from_string(number_match)
full_id = (self.current_interface_id_entries["ID"] << 8) + \
return_number_from_string(number_match)
if full_id in self.return_value_dict:
# print('Duplicate returncode ' + hex(full_id) + ' from ' + file_name +
# ' was already in ' + self.return_value_dict[full_id][3])
pass
dict_tuple = (
string_to_add, description, number_match, file_name, self.current_interface_id_entries["FullName"]
string_to_add, description, number_match, file_name,
self.current_interface_id_entries["FullName"]
)
self.return_value_dict.update({
full_id: dict_tuple