parse_debug – Debug parsing of Tripoli-4 outputs

Extension of parse module for debugging.

Main difference is the possibility of using the end_flag parameter in the scan.

class valjean.eponine.tripoli4.parse_debug.ParserDebug(jddname, *, end_flag='', ofile='')[source]

Scan up to the end flag then parse. For parsing debugging.

__init__(jddname, *, end_flag='', ofile='')[source]

Initialize the ParserDebug object.

Parameters:
  • jddname (str) – path to the Tripoli-4 output

  • batch (int) – batch to read (-1 = last, 0 = all, then X)

  • end_flag (str) – optional end flag to stop scanning and parsing (empty string per default)

It also initalize the result of scan.Scanner to None and the parsing result, from pyparsing, to None.

If the path contains the "PARA" string, the checks will be done for parallel mode.

parse_from_number(batch_number, name='')[source]

Parse from batch index or batch number.

Per default the last batch is parsed (index = -1).

Parameters:

batch_number (int) – the number of the batch to parse

Returns:

list(dict)

check_parsing(parsed_res)[source]

Check if parsing went to the end:

  • if the end flag was not precised, a time should appear in the last result;

  • if not, no check can be performed as the end flag can be anywhere, even “transformed” during parsing.

Print a logger message if not found but don’t block access to the parsing result (this can help to find the issue).