Reads Q2NS simulation trace files in NDJSON or JSON-array format.
More...
|
| tuple[list[dict[str, Any]], list[str]] | parse (str content) |
| | Parse a string containing a Q2NS trace in NDJSON or JSON-array format.
|
| |
| tuple[list[dict[str, Any]], list[str]] | load_from_file (str filepath) |
| | Read a simulation trace file from disk and delegate to parse().
|
| |
Reads Q2NS simulation trace files in NDJSON or JSON-array format.
Both formats are auto-detected by inspecting the first non-whitespace character of the content string:
- JSON array: content begins with
[; the entire file is parsed as a single json.loads call.
- NDJSON: each non-empty line is an independent JSON object.
Definition at line 1270 of file logic.py.
◆ load_from_file()
| tuple[list[dict[str, Any]], list[str]] q2nsviz.logic.EventFileParser.load_from_file |
( |
str |
filepath | ) |
|
|
static |
Read a simulation trace file from disk and delegate to parse().
- Parameters
-
| filepath | Absolute or relative path to the trace file. Must be UTF-8 encoded. |
- Returns
- Same
(events, errors) tuple as parse().
- Warning
- Raises
OSError if the file cannot be opened.
Definition at line 1319 of file logic.py.
◆ parse()
| tuple[list[dict[str, Any]], list[str]] q2nsviz.logic.EventFileParser.parse |
( |
str |
content | ) |
|
|
static |
Parse a string containing a Q2NS trace in NDJSON or JSON-array format.
- Parameters
-
| content | Raw file content as a Unicode string. |
- Returns
(events, errors) where events is the list of successfully parsed event dicts and errors lists any human-readable parse failures (empty on success).
Definition at line 1283 of file logic.py.
The documentation for this class was generated from the following file: