iwfm.skip_ahead

iwfm.skip_ahead(line_index, all_lines, skip=0)[source]

Increment line_index by skipping (a) every line that begins with ‘C’, ‘c’ ‘*’ or ‘#’ and (b) ‘skip’ additional lines.

Stop if last line (all_lines) is reached

Parameters:
  • line_index (int) – current line number

  • all_lines (list) – each item is one line from a file

  • skip (int, default=0) – number of non-comment lines to skip

Returns:

line_index – new current line or -1 if end reached

Return type:

int

Raises:
  • ValueError – If line_index is negative or skip is negative

  • TypeError – If all_lines is not a list or line_index/skip are not integers