deMonPy.ioread

Back to DeMonNanoPy API Reference

Description

Line/block-based parser base class and tolerance decorator.

Source file: deMonPy/ioread.py

Classes

IOread

Utilities for reading block-delimited output sections.

Methods

Method Signature Description
__init__ __init__() Initialize parsing state (current block, counters).
compute_block compute_block(line, ctrl_in="", ctrl_out="", nb_line=None, add=1) Track block entries/exit for a control-section parser.
get_float get_float(line, index=-1) Extract a float from a line.
get_int get_int(line, index=-1) Extract an int from a line.
get_list get_list(line, index_in=None, index_out=None, ctype=np.float64) Extract a list of numbers from a line.
get_dict get_dict(...) Extract a key/value mapping from a line.
get_string get_string(line, index=None) Extract a string from a line.
is_inside is_inside(control="", line="") Check whether a line is inside a given control section.

Functions

Function Signature Description
safe_parse safe_parse(*keys, default=None) Decorator: when ignore_parse_errors=True, record the failure in complet_results['errors'] (kind "parse"), reset the given keys to the default and return it instead of raising.