Parser

Terminal module to hold the parsing functions and constants.

ANSI_ESCAPE_SEQ = re.compile('\\x1B(?:[@-Z\\\\-_]|\\[[0-?]*[ -/]*[@-~])')

The compiled regex to clean the ANSI escape sequence

clean_parsed_text(text)[source]

Clean the parsed text.

Return type:

str

Note

This will remove ANSI escape sequences and newline/returnlines feeds.

Returns:

The cleaned string.

Return type:

str

find_output_by_index(index, output)[source]

Find a given output from the parsed output list with index.

Return type:

str

Parameters:
  • index (int) – The index to be accessed from the list

  • output (list) – The output list to be searched.

Returns:

In case it finds the output, otherwise, empty string.

Return type:

str

parse_terminal_output()[source]

Parse collected terminal output.

Return type:

list[dict[str, str]]

Returns:

A reversed list containing the parsed data. If no file was found, we just return empty list.

Return type:

list[dict[str, str]]