Parser

class efj_parser.Parser

Parser for electronic Flight Journal (eFJ) files.

parse(s: str, hook: Callable[[str, int, str, date | Duty | Aircraft | list[Crewmember] | Sector | str], None] | None = None) tuple[tuple[Duty, ...], tuple[Sector, ...]]

Extract duties and sectors from an eFJ string

Parameters:
  • s – A string containing data in eFJ format

  • hook – A function that, if specified, will be called after each line is processed. The function will be called with the positional parameters line text, line number, line type and parsed object. Line type may be “blank”, “comment”, “date”, “short_date”, “aircraft”, “crewlist” or “sector”.

Returns:

Two tuples containing the extracted data. The first is a tuple of Duty structures and the second is a tuple of Sector structures.